output parameter query | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

output parameter query

hi all
plz help me out……..
i want to use a output variable in my stored procedure…….
please make one for me….. CREATE PROCEDURE krish(@output1 nvarchar(10) output)
AS
BEGIN
/* Procedure body */ select @output1=’Krishan’ END how output variable be used in returning multiple variable…….
can u give any example…….
the proc you provided returned one outputparameter. To get it you’ll have to specify it when calling the sproc
declare @myoutput1 nvarchar(10)
exec krish @myoutput1 OUTPUT — you have to specify OUTPUT to get the parameter to work print @myoutput1 you can have multiple output parameters
e.g.
CREATE PROCEDURE krish(@output1 nvarchar(10) output
, @anotheroutput int output)
AS
BEGIN
/* Procedure body */ select @output1=’Krishan’, @anotheroutput =5 END
declare @myoutput1 nvarchar(10)
declare @myint int
exec krish @myoutput1 OUTPUT — you have to specify OUTPUT to get the parameter to work
, @myint OUTPUT
print @myoutput1
print @myint

Check BOL topic "CREATE PROCEDURE (Transact-SQL)" and under "CREATE PROCEDURE (Transact-SQL)" check "Using OUTPUT parameters" sub title…
MohammedU.
Microsoft SQL Server MVP
Moderator
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

<<
how output variable be used in returning multiple variable…….
>> What do you mean y multiple variable? Madhivanan Failing to plan is Planning to fail
]]>