Hi
Assuming Asp.Net app calls procedure dbo.ApprovePost and @@ERROR contains a value greater than 0, then the following code will be executed:
CREATE PROCEDURE dbo.ApprovePost
…
IF @@ERROR > 0
BEGIN
RAISERROR(‘Approval of post failed’, 16, 1)
ROLLBACK TRANSACTION ApprovePost
RETURN 99
END
COMMIT TRANSACTION ApprovePost
a) I don’t know much about stored procedures, but I thought that when RAISERROR raises an error, then no code after RAISERROR will be executed, since procedure will exit the moment error was raised?!
b) I assume RAISERROR function will return the error message back to calling Asp.Net application?
c) If so, then why does procedure also need to return value 99 to indicate failure ( BTW – I assume this value is returned to the calling Asp.Net application )?
d) And why value 99? Why not 100 or any other value?
thanx