Friday, August 21, 2009

Stored Procedure for login count and update the count in a table

alter procedure login_check_value (@username varchar(15),@pass_word varchar(15))
as
declare @result int
begin
if(EXISTS(select * from table_check where username=@username and pass_word=@pass_word))
begin
Set @result=(select access from table_check where username=@username and pass_word=@pass_word)
set @result=@result+1
update table_check set access=@result where username=@username and pass_word=@pass_word
end
else
begin
set @result=0
update table_check set access=@result where username=@username and pass_word=@pass_word
end
begin
select * from table_check
end
end

No comments: