Error Handling in SQL 2000

  • I have some really long stored procedures that do insert and update and sometimes fail because of an error with invalid data. It inserts or updates multiple rows and uses cursor to loop through them and if 1 insert or update fails the whole process fails. Is there a way I can handle this error and record the error in a errorlog table with the field name which had the invalid data and caused the error because I have about 900 fields in that table and very hard to find which field caused the error. After recording the error I want to move to the next and process it normally. If this can be done it would really helpful. Right now I am calling these stored procedures from asp.net page and tried to create a loop in asp.net but I am not able to get the field name in the error returned by sql server and adding validation for 900 fields also would be very difficult but if that is the only way may be someone can tell if a validation script can be generated automatically based on the data type by looping through all fields in a table. Thank you very much for your help.

  • Out of curiosity, what does this table with 900 fields hold? (Or maybe a better question would be what doesn't it hold)

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • It has been created based on some standards created by the hotel industry for generating flat files for all hotel chains which have to be imported in to this table.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply