Create Procedure submitrecord ( @ID varchar(10), @Password varchar(10), @EMailID varchar(50), @QueryType varchar(1) ) if(@QueryType = 'I') Begin INsert into login(ID1,Password1,EMailID)values(@ID,@Password,@EMailID) END Else if(@QueryType = 'U') Begin Update login Set Password1=@Password, EMailID=@EMailID Where ID1=@ID End
I m not able to find the in above SPRoc,Error is coming Incorrect syntax near the keyword 'if'
|
| Author: dom 07 Nov 2009 | Member Level: Silver | Rating:  Points: 2 |
Create Procedure submitrecord @ID varchar(10), @Password varchar(10), @EMailID varchar(50), @QueryType varchar(1) as begin
if(@QueryType = 'I') Begin INsert into login(ID1,Password1,EMailID) values(@ID,@Password,@EMailID)END Else if(@QueryType = 'U') BeginUpdate login Set Password1=@Password, EMailID=@EMailID Where ID1=@IDEnd end
try the above query.......u should give 'as' ,'begin',and end at the last
rate if u satify
|
| Author: Shivraj Singh Rajawat 07 Nov 2009 | Member Level: Bronze | Rating:  Points: 2 |
code is looking absolutely fine..........
Cause of error may be there is not space between ) and values. ......
try it.......
|
| Author: Shivraj Singh Rajawat 07 Nov 2009 | Member Level: Bronze | Rating:  Points: 2 |
Create Procedure submitrecord (@ID varchar(10), @Password varchar(10), @EMailID varchar(50), @QueryType varchar(1) ) begin
if(@QueryType = 'I') Begin INsert into login(ID1,Password1,EMailID) values(@ID,@Password,@EMailID)END Else if(@QueryType = 'U') BeginUpdate login Set Password1=@Password, EMailID=@EMailID Where ID1=@ID End end
now it is working fine.........
|
| Author: Hari 07 Nov 2009 | Member Level: Gold | Rating:    Points: 6 |
Hi
use the folling there seesm tobe no space between end and begin
Create Procedure submitrecord ( @ID varchar(10), @Password varchar(10), @EMailID varchar(50), @QueryType varchar(1)) as if(@QueryType = 'I') Begin INsert into login(ID1,Password1,EMailID) values(@ID,@Password,@EMailID) END Else if(@QueryType = 'U') Begin Update login Set Password1=@Password, EMailID=@EMailID Where ID1=@ID End
|
| Author: Sonia sardana 07 Nov 2009 | Member Level: Gold | Rating:  Points: 2 |
hi thx to all,but hary code is working correctly out of all the anwers
|
| Author: Bunty 09 Nov 2009 | Member Level: Diamond | Rating:  Points: 2 |
Hi,
Please find the below code
Create Procedure submitrecord @ID varchar(10), @Password varchar(10), @EMailID varchar(50), @QueryType varchar(1) AS BEGIN if @QueryType = 'I' Begin INsert into login(ID1,Password1,EMailID)values(@ID,@Password,@EMailID) END Else if @QueryType = 'U' Begin Update login Set Password1=@Password, EMailID=@EMailID Where ID1=@ID End END
Thanks & Regards S.S.Bajoria
|