I’m trying to debug a problem with a create statement I have however the error message doesn’t really make any sense.
The script is:
CREATE TABLE marlin.SupportLog
(
IssueID INTEGER UNIQUE NOT NULL,
TypeID INTEGER NOT NULL ,
IssueDescription VARCHAR(5000) NOT NULL ,
MinutesSpent INTEGER NOT NULL ,
PriorityID INTEGER NOT NULL ,
UserID INTEGER NOT NULL ,
SubmittedDate DATETIME NOT NULL DEFAULT SYSDATETIME() ,
LastModifiedDate DATETIME NULL DEFAULT SYSDATETIME() ,
LastModifiedUserID INTEGER NULL
CONSTRAINT SupportLog_pk
PRIMARY KEY NONCLUSTERED (IssueID)
CONSTRAINT TypeID_fk
FOREIGN KEY (TypeID)
REFERENCES marlin.SupportIssueType(TypeID)
CONSTRAINT SLPriorityID_fk
FOREIGN KEY (PriorityID)
REFERENCES marlin.SupportPriority(PriorityID)
CONSTRAINT UserID_fk
FOREIGN KEY (UserID)
REFERENCES marlin.SupportUsers(UserID)
);
If I comment out the last two constraints the table works fine however if I run it as above I receive:
Msg 8148, Level 16, State 0, Line 1
More than one column FOREIGN KEY constraint specified for column 'LastModifiedUserID', table 'marlin.SupportLog'.
Msg 8148, Level 16, State 0, Line 1
More than one column FOREIGN KEY constraint specified for column 'LastModifiedUserID', table 'marlin.SupportLog'.
The error doesn’t appear to help – what am I not understanding / what have I done wrong?
The
CREATE TABLEstatement is missing a comma before eachCONSTRAINT.