Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing arguments by reference
Message
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Passing arguments by reference
Divers
Thread ID:
00941576
Message ID:
00941576
Vues:
54
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform