基本的に、登録すると(登録の詳細はログインテーブルに移動します)、このデータは2つのテーブルに移動します。
- ログインテーブル
- 登録表(特定)
を使用し@Attrib
て、どのデータをどのテーブルに移動する必要があるかを確認します。しかし、ここでは最初のelse
部分の近くでエラーが発生しています。
エラーは次のとおりです。
SELECTまたは、'('を期待する'@Attrib'の近くの構文が正しくありません
コードは次のとおりです。
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
さらに明確にするために、私は以下の画像を添付しました: