SQL Return Code - 6

I got a -6 as a return code from an SP but I have no idea what -6 is and cannot find a reference to it. Can anyone shed some light?

Thanks,
Dean
dthansenAsked:
Who is Participating?
 
Chris WongConnect With a Mentor Commented:
If you have a RETURN statement with an explicit return value, that is of course the return value.

But if there is no RETURN statement, but an error occurs during execution, the return value is 10 minus the severity level of the error. Division by zero is level 16, thus the return value is -6. Permissions errors are typical level 14, thus the return value is -4.

As you may guess this is not terribly useful, but this: 0 is success, and everything else is an error.

<competing site link removed - GaryC123 - 1st Nov>
0
 
HuaMinChenSystem managerCommented:
Try to read the codes of the SP for the details of the return parameter.
0
 
Louis01Commented:
I'd suggest you update the SP to show more about the error.

For instance:

BEGIN TRY
    -- Generate a divide-by-zero error.
    SELECT 1/0;
END TRY
BEGIN CATCH
    SELECT
        ERROR_NUMBER() AS ErrorNumber
        ,ERROR_SEVERITY() AS ErrorSeverity
        ,ERROR_STATE() AS ErrorState
        ,ERROR_PROCEDURE() AS ErrorProcedure
        ,ERROR_LINE() AS ErrorLine
        ,ERROR_MESSAGE() AS ErrorMessage;
END CATCH;

Open in new window

0
All Courses

From novice to tech pro — start learning today.