-- 存储过程--
CREATE proc proc_test (@username char(10),@userpassword char(10), @userage int, @outdata int output)
as
declare @userID int
if exists (select username from testtable where username = @username)
begin
set @outdata = -1
end
else
begin
select @userID = isnull(max(userID),100000)+ 1 from testtable
insert into testtable
(userID,username,userpassword,userage,createtime)
values
(@userID,@username,@userpassword,@userage,getdate())
set @outdata = 1
end
GO