Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get a value from a stored procedure
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01120807
Message ID:
01120920
Vues:
19
>I need to return a money value from a stored procedure. I cant use a function because the procedure does an insert and an update. I can't use a stored procedure because return will only return integer, and if i use a select statement then i can't capture the value for further use in my calling procedure. What would be the best way to accomplish this?

Use OUTPUT parameter:
create procedure MyProc 
(
@parameter1 (type here),
...
@returnpar money OUTPUT
)
AS
  begin
    SELECT @returnpar = NeededColumn FROM MyTable WHERE ....
  END
Then you just can do (in QA)
DECLARE @TestMoney money
EXEC MyProc (parameters here w/o output one), @TestMoney OUTPUT
print @TestMoney
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform