登录注册sql

select * from LoginUser

go
alter proc p_Add
(
@UserName nvarchar(50),
@UserPassword nvarchar(50)
)
as
begin
insert into LoginUser values (@UserName,@UserPassword,0)
select @@IDENTITY
end

go
alter proc p_Login
(
@UserName nvarchar(50),
@UserPassword nvarchar(50)
)
as
begin
select * from LoginUser where UserName=@UserName and UserPassword=@UserPassword and UserError<3
end

go
create proc p_Update
(
@UserID int,
@UserPassword nvarchar(50)
)
as
begin
update LoginUser set UserPassword=@UserPassword where UserID=@UserID
select @@ROWCOUNT
end

go
create proc p_Get
as
begin
select * from LoginUser
end

exec p_Get

go
create proc p_Error
(
@UserName nvarchar(50)
)
as
begin
begin try
begin tran
Update LoginUser set UserError=UserError+1 where UserName=@UserName
commit tran
end try
begin catch
rollback tran
end catch
end

原文地址:https://www.cnblogs.com/hianb/p/10003114.html