DDL:
CREATE TABLE [dbo].[Admin_Profile](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Ad_Regid] AS ('R'+right('200'+CONVERT([varchar](10),[ID],(0)),(6))) PERSISTED NOT NULL,
[Ad_Fname] [varchar](25) NULL,
[Ad_Lname] [varchar](25) NULL,
CONSTRAINT [PK_Admin_Profile] PRIMARY KEY CLUSTERED
(
[Ad_Regid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SP:
create procedure _insertAdminProfile
(
@Ad_Fname varchar(25),
@Ad_Lname varchar(25),
@Ad_Pwd varchar(7) Out
as
Begin
insert into dbo.Admin_Profile (Ad_Fname,Ad_Lname) values (@Ad_Fname,@Ad_Lname);
SELECT ISNULL(MAX(@Ad_Pwd), 0) + 1 FROM dbo.Admin_Profile
end
我尝试了很多方法来获取 insert.Ad_Regid... 的输出...没有得到,我也尝试了 select @Ad_Regid = SCOPE_IDENTITY()
。
谢谢...