I'm having an issue on settin up SqlException.Number
On my Stored Proc i'm raising an error
--@number = 50001
RAISERROR(@number, 16, 1) -
I should expect that the Error_Number()
should be @number
but I always get 18054
Is there something wrong with my RAISERROR
?
Check the sys.messages table for error code 74601. if this is a user defined error, it shouold be added in the table.
for any error that is greater than 50000 should give you this output if not found.
Msg 18054, Level 16, State 1, Line 1
Error XXXXX, severity 16, state 1 was raised, but no message with that error number was found in sys.messages. If error is larger than 50000, make sure the user-defined message is added using sp_addmessage.