Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Noémio writes "hi! i would like to know how to write a stored procedure wtih multiple in and out parameters. thanx"
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts
Posted - 2006-07-14 : 09:01:45
You can define as many in & out parameters as u want, only you have to suffix output parameters with keyword OUTPUT.here is an example from BOL:
CREATE PROCEDURE get_sales_for_title@title varchar(80), -- This is the input parameter.@ytd_sales int OUTPUT -- This is the output parameter.AS -- Get the sales for the specified title and -- assign it to the output parameter.SELECT @ytd_sales = ytd_salesFROM titlesWHERE title = @titleRETURNGO