I have a massive stored procedure that I did not write. It's about 10K lines long. Part of it creates a few temp tables, inserts some records into these tables, then goes through about 8,000 lines of validation and removes invalid records from the tables and re-inserts them into a temp Error
table for reporting back to the user.
Somewhere along the lines, I get the following SqlException
in my C# code:
Conversion failed when converting the varchar value 'AAAAAAAABA683' to data type int.
But if I shorten the value down to just A683
or something, the procedure runs as expected and just marks this particular record as an error. So it sounds to me like it's not actually a problem with the data types, but something else.
Unfortunately the LineNumber
property of the SqlException
I catch doesn't help me, since I don't have access to seeing the actual SQL being executed. I can only look at the procedure itself.
Has anyone encountered something like this before?