I have an sp in SQL Server that when errors returns -4
What does -4 mean? Is there a table somewhere explaining what the possible return values are?
Th
For example
declare @RetVal int EXEC @RetVal = stpTest select @RetValwhere
stpTestisSELECT 1/0returns -6.-6 must mean something!
If you have an sp that does not return anything i.e. it doesn't have any select statements in it and you do:
declare @RetVal int EXEC @RetVal = yourSPNameThen
@RetValwill have a value of 0.If there is an error then
@RetValwill be a value other then zero, for example if the only thing your sp does isSELECT 1/0then@RetValwill be -6.Try it and see
First of all, thanks for bothering to craft an example that returns -6.
Here's what the documentation says about -6:
-6 Miscellaneous user error occurred.
-6 might be the most amorphous code that SQL Server returns.
Why? Because the -6 error code is essentially hiding an error deeper in the call stack.
After troubleshooting this error myself, here are my tips for troubleshooting this error: