我有 2 个表。UniversityReg 和登录。当大学注册到系统时,一般详细信息转到 UniversityReg 表,登录详细信息转到登录表。使用范围标识它需要最后一个 id。但是上面提到的错误显示。
大学注册表
[UniversityId] [int] IDENTITY(1,1) NOT NULL,
[Username] [varchar](50) NULL,
[Password] [varchar](50) NULL,
[UniversityName] [varchar](50) NULL,
[GovernmentRegNo] [varchar](50) NULL,
[Country] [varchar](50) NULL,
[CreatedBy] [varchar](50) NULL,
[ShortCode] [varchar](50) NULL,
登录表
[LoginID] [int] NOT NULL,
[UserName] [nvarchar](50) NOT NULL,
[Password] [nvarchar](50) NOT NULL,
[ShortCode] [nvarchar](50) NULL
SupporterReg 表
[SupporterId] [int] NOT NULL,
[SupporterName] [varchar](50) NULL,
[University] [varchar](50) NULL,
[ContactNo] [varchar](50) NULL,
[Email] [varchar](50) NULL,
[StudentLocation] [varchar](50) NULL,
[ImagePath] [varchar](50) NULL,
[ShortCode] [varchar](50) NULL,
要插入数据,我使用以下存储过程,
CREATE PROCEDURE [dbo].[UniversityReg_SP]
(
@Username varchar(50),
@Password varchar(50),
@UniversityName varchar(50) ,
@GovernmentRegNo varchar(50) ,
@Country varchar(50) ,
@CreatedBy varchar(50)
)
AS
DECLARE @LoginID int
INSERT INTO UniversityReg values(@UniversityName,@GovernmentRegNo,@Country,@CreatedBy,'UNI')
SET @LoginID = SCOPE_IDENTITY();
INSERT INTO Login values(@LoginID,@Username,@Password,'UNI')
RETURN
错误是什么?我看不到任何表格错误...