Invalid SQL syntax - expected CONSTRAINT name. (Error 3721)

When defining referential integrity from a SQL DDL statement it is necessary to name a constraint when using the CONSTRAINT keyword. If a constraint name is not desired, then do not use the CONSTRAINT keyword. An example of this error would be: CREATE TABLE Customers (CLstNm TEXT(50), CFrstNm TEXT(25), CONSTRAINT PRIMARY KEY (CFrstNm, CLstNm));.

To prevent the error, include a name after the CONSTRAINT keyword:

CREATE TABLE Customers (CLstNm TEXT(50), CFrstNm TEXT(25), CONSTRAINT pkCustomers PRIMARY KEY (CFrstNm, CLstNm));.

or do not use the CONSTRAINT keyword:

CREATE TABLE Customers (CLstNm TEXT(50), CFrstNm TEXT(25), PRIMARY KEY (CFrstNm, CLstNm));.



Community Additions

Show: