基本上当我注册时(注册详细信息进入登录表),然后这些数据进入 2 个表:
- 登录表
- 登记表(具体)
使用@Attrib
我检查哪些数据需要转到哪个表。但是在这里我在第一else
部分附近遇到了一个错误。
错误是:
'@Attrib' 附近的语法不正确,需要 SELECT 或 ,'('
这是代码:
ALTER procedure [dbo].[Registration_SP]
(
@Email varchar(50),
@Password varchar(50),
@Repassword varchar(50),
@Attrib varchar(50)
)
AS
BEGIN
Insert into Login (Email,Password,Repassword,Attrib)
values(@Email,@Password,@Repassword,@Attrib)
IF (@Attrib = 'Student')
BEGIN
Insert into StudentReg
(StudentId,FirstName,LastName,Gender,Address1,Address2,Address3,
LandPhone,MobilePhone,Budget,IsFinancialSupport,CourseName,
IsJobSeeker,Country,Region,IsSupportActive,RegDate,ImagePath,
ShortCode)
Values(@Email,'','','','','','','','','','','','','','','','','','')
END
ELSE (@Attrib = 'Financial Supporter')
BEGIN
Insert into SupporterReg
(SupporterId,SupporterName,University,ContactNo,StudentLocation,RegDate,
ImagePath,ShortCode)
Values(@Email,'','','','','','','')
END
进一步澄清,我附上了下面的图片: