how to solve error in the storeprocedure

Posted by Parthibansk under Sql Server on 4/18/2013 | Points: 10 | Views : 774 | Status : [Member] | Replies : 1
wrote a storedprocedure for restricting no of users registrations daily to 10..

found error while executing..


use employee
go


create proc joinmax
@name varchar(50),@email varchar(50),@phoneno varchar(50),@regdate datetime,@ERROR VARCHAR(100) OUT


as

begin
SET NOCOUNT ON;
(select count(id) from joinees
where year(regdate) = year(getdate())
and month(regdate) = month(getdate())
and day(regdate) = day(getdate())
)
if(count(id)>10



INSERT INTO joinees(name,email,phoneno) values(@name,@email,@phoneno)

SET @ERROR=@name+' Registered Successfully'
END
ELSE
BEGIN


--If User already Exists i am returning this Message as Output Parameter
SET @ERROR=@name + ' max limit reached'
END




Responses

Posted by: Santhi on: 4/18/2013 [Member] Starter | Points: 25

Up
0
Down
Hi

can you please elaborate the type of error which u r getting

Thanks & Regards,
Santhi .V

Parthibansk, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response