1. Getting result from a stored procedure as a RESULT SET (Multi Column / Scalar value)
[Code]Create Proc USP_Sample1
(
@InParamater1 Varchar(25) =''
)As
Begin
Set Nocount On
Select 'Welcome ...' + ISNULL(@InParamater1,'') [Result]
End
Go[/Code][Code]Exec USP_Sample1 'Pandian'
Go[/Code]
2. Getting result from a stored procedure as an OUTPUT Parameter
[Code]Create Proc USP_Sample2
(
@InParamater1 Varchar(25) ='',
@OutParamater1 Varchar(25) Output
)As
Begin
Set Nocount On
Select @OutParamater1 = 'Welcome ...' + ISNULL(@InParamater1,'')
End
Go[/Code][Code]Declare @Result Varchar(25)
Exec USP_Sample2 'Pandian', @Result Output
Select @Result [Result]
Go[/Code]
3. Getting result from a stored procedure as a RETURN
[Code]Create Proc USP_Sample3
(
@InParamater1 Int =0
)As
Begin
Set Nocount On
Return @InParamater1
End
Go[/Code][Code]Declare @Result Int
Exec @Result = USP_Sample3 100
Select @Result [Result]
Go[/Code]Note:
RETURN supports only Numeric data!
Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions
Jasminej, if this helps please login to Mark As Answer. | Alert Moderator