I need to have two primary keys also to be the foreign keys in the same table. These two keys are referenced in different tables. I keep getting error messages that are unclear to me. My code is as follows:
CREATE TABLE ASSIGNMENT ( ProjectID INT NOT NULL, EmployeeNumber INT NOT NULL, HoursWorked NUMERIC(6,2) NULL, CONSTRAINT AssignmentPK PRIMARY KEY(ProjectID,EmployeeNumber), CONSTRAINT AssignmentFK FOREIGN KEY(EmployeeNumber, ProjectID) REFERENCES EMPLOYEE(EmployeeNumber) ON UPDATE NO ACTION ON DELETE NO ACTION, REFERENCES PROJECT(ProjectID) ON UPDATE NO ACTION ON DELETE CASCADE );
The current error message is:
Msg 142, Level 15, State 2, Line 2 Incorrect syntax for definition of the 'TABLE' constraint.