create proc procaddperson
(@userid char(40),
@name char(40)
@title char(40),
@dept char(40),
@phone char(40),
@password char(40)
)as
begin tran
if exists( select * from ftabperson where userid=@userid)
bgein
rollback tran
return 10 --人已存在
end
insert into ftabperson(userid,name,title,dept,phone,password)
values(@userid,@name,@title,@dept,@phone,convert(varbinary(300),@password))
if @@error<>0
begin
roll tran
return 20 --意外错误
end
else
begin
commit tran
return 1
end