in the object browser, what is and how to use 'returns' in the parms list of a stored procedure

  • Hi,

    Ive googled but i guess it so simple no one put it out there but it bugs me.

    in the object browser, what is and how to use 'returns' in the parms of a sproc

    you know the last parameter entry of a stored proc's parm list 'returns'

    .what is it for and how can i utilize it in code?

    All i could get is it returns 0 or 1 if succeded. but how in code could I check for this and could it be useful?

    thanks in advance

  • you can use

    return(@yourcode)

    to provide an exit code for your sproc.

    in your app you can capture this value using the first parameter @return_value.

    e.g.

    If sqlcmd.Parameters("@RETURN_VALUE").Value.ToString = "0" Then

    '.....

    Else

    rc = CType(sqlcmd.Parameters("@RETURN_VALUE").Value.ToString, Integer)

    Throw New Exception("Invalid RETURN_VALUE")

    End If

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Ahh, I get how to use it now thanks!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply