CREATE PROCEDURE sp_adduserr

	@OutUserID	int output,
	@UserName	      varchar(25),
 	@UserType	      tinyint,
	@UserBrief	varchar(255)

AS
/*声明一个局部变量*/
Declare @UserID int
/*将用户名、用户类型插入到用户表中*/
insert into UserMain( UserName, UserType) values( @UserName, @UserType)
/*取得自动生成的用户 ID */
select @UserID = @@IDENTITY
/*将用户说明插入到用户说明表中*/
insert into UserRef(UserID, UserBrief) values (@UserID, @UserBrief)
/*设置返回值*/
select @OutUserID=@UserID
GO
