Click here to Skip to main content
15,912,977 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
SQL
alter procedure chkloginSP(@ui varchar(50),@pass varchar(50),@no int out)
as
begin
select @no=COUNT(*) from loginc where userid=@ui and password=@pass
end



exec chkloginSP 'sa',123456,@no
Msg 137, Level 15, State 2, Line 1
Must declare the scalar variable "@no".
Posted
Updated 14-Oct-10 1:37am
v2

Hi sampath,

SQL
ALTER procedure chkloginSP(@ui varchar(50),@pass varchar(50),@no int out)
as
begin
select @no=COUNT(*) from loginc where userid=@ui and password=@pass
end



This is running pretty fair at my end. I use sql server 2005. Also, I can see the variable @no is declared correctly in the parameters. No problems with that. Maybe you're not selecting the whole stored procedure while executing it. Try it once again.
 
Share this answer
 
v2
I think the error message is fairly clear. You have not declared a variable named @no
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900