Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing arguments by reference
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Passing arguments by reference
Miscellaneous
Thread ID:
00941576
Message ID:
00941576
Views:
53
I'm trying to call a SP (from another SP) with arguments that needs to be modified by the called SP.

I could not find references on passing arguments by reference, so I tried with the OUTPUT argument modifier. Here is a simple example to explain my approach.

USP_O_MYPROC @ORIGINAL_VALUE INT, @NEW_VALUE INT OUTPUT
...
...
SET @NEW_VALUE = @ORIGINAL_VALUE + 1 !!! complex ;-)
IF @NEW_VALUE IS NULL SET @NEW_VALUE = 0 !!! you'll see why later...
RETURN


When I call the SP, I simply do:
EXEC USP_O_MYPROC @tata, @tata

I tough that by doing so, @tata whould containt it's original value + 1...
But @tata is null !!!! I'm puzzled ;-)

The IF @NEW_VALUE IS NULL SET @NEW_VALUE = 0 line does not even change a thing...


So what am I doing wrong here ;-)


Thanks.
Next
Reply
Map
View

Click here to load this message in the networking platform