.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> SQL Query >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Return Value from SP Using OUTPUT Paramete

Posted By:Prasanti Prusty       Posted Date: February 24, 2010    Points: 10    Category: SQL Query    URL: http://www.dotnetspark.com  

Return Value from SP Using OUTPUT Paramete
 


/*
Here spGetOutput is Having 2 parametes.
    @ID : Input Param
    @Name : Output Param

After Executing the SP . It Return @Name as OUTPUT Param.
*/


CREATE PROCEDURE spGetOutput
	@ID INT = NULL,
	@Name VARCHAR(200) OUTPUT
AS
BEGIN
	IF @ID IS NOT NULL
	BEGIN
		SELECT @Name= UserName FROM tbUserMst WHERE UserID=@ID 
	END
	ELSE 
	BEGIN
		SELECT @Name= 'Please Provided the UserID.'
	END
END



     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend