0
Hello @Srinivasulu there is a little mistake your are using USERNAME='@USERNAME' this is not proper way. in this case system '@USERNAME' treat as a string not as a variable
use this
CREATE PROCEDURE [DBO].[SP_LOGIN]
@USERNAME VARCHAR(50),
@PASSWORD VARCHAR(50),
@RESULT VARCHAR(50) OUT
AS
BEGIN
SET NOCOUNT ON;
SELECT count(*) FROM TBL_USERDETAILS WHERE USERNAME = @USERNAME AND PASSWORD = @PASSWORD
RETURN
END
0
Hi,
I validation correct assign return value 1. other wise return value 0. You should assign value before return.
0
Hi Srini,
You are getting 0 always return value due to following reason:
You are using @Result as output parameter but not assigning anywhere inside SP.
Secondly single qoute(' ') is used in parameters when fetching rows.
Please find updated code:
Code:
ALTER PROCEDURE [DBO].[SP_LOGIN]
@USERNAME VARCHAR(50),
@PASSWORD VARCHAR(50),
@RESULT VARCHAR(50) OUT
AS
BEGIN
SET NOCOUNT ON;
SELECT @RESULT = COUNT(*) FROM TBL_USERDETAILS
WHERE USERNAME = @USERNAME AND PASSWORD = @PASSWORD;
RETURN @RESULT;
END
0
Hi,
Try this:
SELECT count(*) FROM TBL_USERDETAILS WHERE USERNAME = @USERNAME AND PASSWORD = @PASSWORD