Table of contents
TOC
Collapse the table of content
Expand the table of content

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

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Applies to: Access 2013 | Access 2016

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));. ACCESS SUPPORT RESOURCES
Access for developers forum on MSDN
Access help on support.office.com
Access help on answers.microsoft.com
Search for specific Access error codes on Bing
Access forums on UtterAccess
Access wiki on UtterAcess
Access developer and VBA programming help center (FMS)
Access posts on StackOverflow

© 2018 Microsoft