What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 48004 |  Welcome, Guest!   Register  Login
 Home > Forums > Sql Server > Kindly Clarify: What are all the ways to get the Result from a Stored Proce ...
Jasminej

Kindly Clarify: What are all the ways to get the Result from a Stored Procedure ?

Replies: 2 | Posted by: Jasminej on 4/27/2012 | Category: Sql Server Forums | Views: 274 | Status: [Member] | Points: 10  


What are all the ways to get the Result from a Stored Procedure ?

Kindly give me an example

Thank You


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Pandians
Pandians  
Posted on: 4/27/2012 9:13:34 AM
Level: Silver | Status: [Member] [MVP] | Points: 25

1. Getting result from a stored procedure as a RESULT SET (Multi Column / Scalar value)
Create Proc USP_Sample1

(
@InParamater1 Varchar(25) =''
)As
Begin
Set Nocount On
Select 'Welcome ...' + ISNULL(@InParamater1,'') [Result]
End
Go
Exec USP_Sample1 'Pandian'

Go


2. Getting result from a stored procedure as an OUTPUT Parameter
Create Proc USP_Sample2

(
@InParamater1 Varchar(25) ='',
@OutParamater1 Varchar(25) Output
)As
Begin
Set Nocount On
Select @OutParamater1 = 'Welcome ...' + ISNULL(@InParamater1,'')
End
Go
Declare @Result Varchar(25)

Exec USP_Sample2 'Pandian', @Result Output
Select @Result [Result]
Go


3. Getting result from a stored procedure as a RETURN
Create Proc USP_Sample3

(
@InParamater1 Int =0
)As
Begin
Set Nocount On
Return @InParamater1
End
Go
Declare @Result Int

Exec @Result = USP_Sample3 100
Select @Result [Result]
Go
Note:
RETURN supports only Numeric data!


Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Jasminej, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Jasminej
Jasminej  
Posted on: 4/30/2012 1:02:28 AM
Level: Starter | Status: [Member] | Points: 25

Thank You very much

Jasminej, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 9:13:58 AM