Scenario: A large stored procedure is run thousands of time a day, 6 days a weeks every year. For this one specific situation I'm getting an error
Msg 8152, Level 16, State 14, Line 114
String or binary data would be truncated
This stored procedure is about 800 lines of code, with lots of parameters, lots of variables and lots of tables.
Go
@exampleParam varchar(30)
@exampleParam datetime
DECLARE @declaredvara VARCHAR(50);
DECLARE @declaredvarb VARCHAR(50); -- where the line error is according to the printout
DECLARE @declaredvarc VARCHAR(50);
DECLARE @declaredvard VARCHAR(50); -- where line error is adjusted for comments in front of GO
BEGIN TRANS
-- some calculations (700+ lines)
COMMIT TRANS
--error catch
ROLLBACK TRANS
Problem: I'm want to know if its possible to get an accurate Line error read, so I can at least narrow down which tables I have to check. There are tons of tables involved in this stored procedure.
*** Both declared variables(before and after adjustment of GO) it points to are dead weight, they're nvr used.
Bonus info: I ran the stored procedure with params populated and params = '' except for the datetimes. In both cases I got the same error. However, I know the stored procedure works because it's being used thousands of times a day w/out this error.
EXEC SP '','','','','2014-11-6'
EXEC SP 'XX_XX_XX','',1,'','2014-11-6'
--both return the same error of Msg 8152, Level 16, State 14
--XX is a specific serialnum.
--However all other serialnum have no problem
EDIT: The DB is running SQL Server 2005 EDIT2: I'm using SQL Server 2008 to edit. - So debug isn't an option