selva kumar

selva kumar

  • NA
  • 557
  • 183.9k

How to solve this error?

May 20 2014 1:04 AM
Hi i have created stored procedure for user login but it throws error..can any one help me out..

Create Table Tbl_Login(T_Id Int Identity(1,1),Mode Varchar(50),UserName Varchar(50),[PassWord] Varchar(50));

Select * From Tbl_Login;

Truncate Table Tbl_Login;

Drop Table Tbl_Login;

/*Stored procedure for User_Login*/

Create Proc SP_Login(@Mode Varchar(50),@Name Varchar(50),@PassWord Varchar(50,@Res INTEGER Output)
as
if exists(Select Mode,UserName,[PassWord] From Tbl_Login Where Mode=@Mode and UserName=@Name and [PassWord]=@PassWord)
set @Res=1
else
set @Res=0
go
Exec Proc SP_Login


Error:

Msg 102, Level 15, State 1, Procedure SP_Login, Line 1
Incorrect syntax near '@Res'.
Msg 137, Level 15, State 2, Procedure SP_Login, Line 3
Must declare the scalar variable "@PassWord".
Msg 137, Level 15, State 1, Procedure SP_Login, Line 4
Must declare the scalar variable "@Res".
Msg 137, Level 15, State 1, Procedure SP_Login, Line 6
Must declare the scalar variable "@Res".
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'Proc'.


Answers (3)