I keep getting CREATE TABLE Syntax Error, but I don\'t see the error! What is causing the error?
My SQL:
CREATE TABLE my_employee
(
e
Since your DDL statement includes DEFAULT
, you must execute it with ADO. I loaded your statement into a string variable and executed it from Access 2007 like this:
CurrentProject.Connection.Execute strSql
The salary field is decimal with precision 8, scale 2, and default 15000.
DEFAULT
is one of the Access SQL features added with Jet 4.0. Those features are not available for a statement executed from DAO. If you are using Access' query designer to create and execute the statement, you're using DAO. Same if you were using CurrentDb.Execute
. But CurrentProject.Connection
is an ADO object, so it can .Execute
Jet 4.0 features.
Note NOT NULL
is not necessary after PRIMARY KEY
since PRIMARY KEY
implies NOT NULL
. However PRIMARY KEY NOT NULL
does not trigger an error. The statement works as you originally wrote it as long as you execute it from ADO.