In SSIS 2005, how can I can detect the number of rows from a flat file?
I happen to be importing a flat file to an OLE DB Destination and in case of error in a row, I need to recognize which row caused the error from the "Flat File Source Error Output" for later use.
I tried with the controls "Derived Column", "Import Column", "Sampling of rows, and the connection manager but none allowed me to d开发者_JAVA百科o this, and i would like to avoid the alternative of opening the file with a "Script Task" add the rownumber and import the data Flow Task.
Thanks for the help!
I have this all the time and I usually want to stick the Row numbers into the raw table I'm importing to so I can identify what row is messing up.
In the data flow, add a script component between you source and destination targets. In that script editor, go to "Inputs and Outputs" and under the "Output 0", highlight the output columns, and select the "Add Output" button and name it count or mycount or rows...
Go to the script section and enter
Row.mycount = counter
counter = counter + 1
When you go to your destination target you'll see the mycount and map it to a field you set up in a table. I guess you could also have a Data Viewer if you wanted to see it in real time.
Good luck
Andy
精彩评论