SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Output parameter return from Stored Prodeure
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

itpriyesh88
Starting Member

13 Posts

Posted - 06/08/2012 :  02:19:00  Show Profile  Reply with Quote
I actually wants to return an integer value from my SP.

My SP is something like this:

Create procedure LOGINUSER
(
@USERNAME VARCHAR(200),
@PASSWORD VARCHAR(200),
@LOGINFLAG INT OUTPUT
)
AS
SELECT * FROM Users WHERE Username=@USERNAME AND Password=@PASSWORD

GO


** this select statement should return ant integer value in my output parameter @LOGINFLAG.

this int variable i'll use in my asp code to check for the valid login..
Please help!!!

vinu.vijayan
Posting Yak Master

India
227 Posts

Posted - 06/08/2012 :  02:27:10  Show Profile  Reply with Quote
To get output from a Stored Procedure you have to use Output Parameters.

The Following link will be helpful for you:

http://sqlserverpedia.com/wiki/Stored_Procedures_-_Output_Parameters_%26_Return_Values

N 28° 33' 11.93148"
E 77° 14' 33.66384"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47189 Posts

Posted - 06/08/2012 :  11:56:43  Show Profile  Reply with Quote
quote:
Originally posted by itpriyesh88

I actually wants to return an integer value from my SP.

My SP is something like this:

Create procedure LOGINUSER
(
@USERNAME VARCHAR(200),
@PASSWORD VARCHAR(200),
@LOGINFLAG INT OUTPUT
)
AS
SELECT * FROM Users WHERE Username=@USERNAME AND Password=@PASSWORD

GO


** this select statement should return ant integer value in my output parameter @LOGINFLAG.

this int variable i'll use in my asp code to check for the valid login..
Please help!!!


if its integer value you can also use RETURN statement to return status from procedure

see

http://www.sqlteam.com/article/stored-procedures-returning-data

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000