Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Output parameter return from Stored Prodeure

Author  Topic 

itpriyesh88
Starting Member

13 Posts

Posted - 2012-06-08 : 02:19:00
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

227 Posts

Posted - 2012-06-08 : 02:27:10
To get output from a Stored Procedure you have to use Output Parameters.

The Following link will be helpful for you:

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

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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-08 : 11:56:43
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
   

- Advertisement -