I am trying to retrieve errors from SQL like so:
DECLARE @debugerrormsg nvarchar(MAX)
SELECT L.ID, L.Name FROM Lookup L WHERE L1.ID = 1
SET @debugerrormsg = ' + ERROR_MESSAGE() + ' at line ' + cast(ERROR_LINE() as varchar)
RAISERROR(@debugerrormsg, 16, 16)
So you can see that "L1" is wrong so this i'm expecting to output the error and the line number but it does not work. For some reason it does not show the line number..
Any ideas what i'm doing wrong?
View Complete Post