Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Importing and scanning a log file

Author  Topic 

Gigi
Starting Member

23 Posts

Posted - 2009-07-27 : 15:18:47
Hello all,
I saw a recent post on the forum regarding importing log files in sql server. I have a similar task but I am stuck on how to scan the file or the table.....This is what I am trying to do:

My log files look something like this

Row 35 import: OK.
Posting successful
Posting successful
Posting successful
Posting successful
Row 36 import: OK.
Posting successful
Posting successful
Posting successful
Posting successful
Row 37 import: FAILURE.
FAILURE: An invalid value 'ID=.PEC0140009U' was supplied for 'Investment' Data writing (committal) has failed
FAILURE: An invalid value 'ID=.PEC0140009U' was supplied for 'Investment' Data writing (committal) has failed
Row 38 import: OK.
Posting successful
Posting successful
Posting successful
Posting successful


and so on....

to be a little clearer, what I am looking to extract in my process are the failed IDs....so in the above example, I need to extract the failed ID which is ID=.PEC0140009U and insert it into a separate table (from where I will do some data comparisons from another table...but that i have already figured out)

The questions that I have are --
1. If we are able to import the log file through SSIS, how can we query for the failed IDs
2. is there a process in sql server that can allow me to scan/filter the failed ids from the file before I import it into sql server.
3. is there any better way to approach this whole process

thank you all in advance

Gigi
Starting Member

23 Posts

Posted - 2009-07-28 : 09:36:27
anything on this....anyone????
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-07-28 : 11:57:59
What are you using to import your file?
Go to Top of Page

Gigi
Starting Member

23 Posts

Posted - 2009-07-28 : 12:17:12
Lamprey,
Right now I havent actually implemented this....things i also want to know in this thread are various ways to approach this. I am sure I will be able to do it through SSIS. the more relevant question would be whether i import the file in sql and then extract the records i need or should i parse the flat file first and then just import the filtered data.
Go to Top of Page
   

- Advertisement -