handling errors | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

handling errors

Hi I am importing a flat text file int the server and sometimes i get errors on the text file and entire batch import fails. How can i create import procedure so that i only import the lines that correspond to the criteria and rest of the lines be dumped into a table "errors". What would the procedures be for doing this? Anyone have links to sample code that can accomplish this? thanks
Edgar
Upload into a table with all varchar columns that allow nulls, then process row by row from this table. For this processing, you need to convert the data back to the proper data types – which is where you should be able to catch the errors. Once you’ve sorted out the problems, you contact the person who is responsible for putting that data into this flat file, and discuss the correct formatting.
]]>