Hi
How would I create a table using SQL in Access and set the primary key.
This is how I did it in MS SQL
CREATE TABLE mytable(
MyFieldOne VARCHAR(20),
MyFieldTwo VARCHAR(20)
CONSTRAINT PK_MYTABLE PRIMARY KEY (MyFieldOne)
)
GO
I have never tried creating a table in Access code, but you would probably get a faster response if you told us what your problem was. Does this produce an error? Terry M. Hoey
THe JET Engine DDL syntax is slightly different from SQL Server DDL Syntax. For a complete JET Syntax listing open the "Microsoft Jet SQL Reference" in Access HELP. Look in the chapter "Data Definition Language."
This example comes from Access 2000 HELP. I don't know if the syntax was different in earlier versions, but I doubt it was. Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it if you have time.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.