现在的位置: 首页 > 综合 > 正文

判断用户是否存在不存在添加存在返回一个值

2013年10月04日 ⁄ 综合 ⁄ 共 344字 ⁄ 字号 评论关闭

 create proc UserReg
(
@UserName varchar(200),
@UserPWd varchar(200),
@tag int output
)
as
if(exists(select *  from CMS_UserInfo where UserName=@UserName and UserPwd=@UserPwd))
begin
set @tag=0
return @tag
end
else
begin
insert into CMS_UserInfo(UserName,UserPwd) values(@UserName,@UserPwd)
set @tag=1
return @tag
end

declare @tag int
exec UserReg 'jijunwu','jijunwu',@tag output
print @tag

抱歉!评论已关闭.