create access table w/primary key

R

robert orlini

I'm using this code to create a table w/primary key. The
only problem is the primary key is not setup for
autonuimber.

What do I add to the primary key info so that it is
created and setup w/autonumber?
Thanks.

Create table #trialname#
(
id INTEGER,
CONSTRAINT #trialname#_pkey not null PRIMARY KEY (id),
Orderdate Char (50) not null,
Institution Char (50) not null,
Customer Char (50) not null,
address Char (50) not null,
city Char (10) not null,
state Char (10) not null,
zip Char (5) not null,
phone Char (8) not null,
login Char (10) not null,
email1 Char (50) not null)
 
A

Arvin Meyer

That doesn't look like Access DDL. It looks more like SQL-Server.

This works in JET:

CREATE TABLE tblContacts
([ContactID] counter,
[LastName] text (30),
[FirstName] text (30),
[FullName] text (60),
[ContactDate] date,
[Notes] memo,
CONSTRAINT [ContactID] PRIMARY KEY ([ContactID]));

I suspect the line you're looking for might be (I can't test now):

ID IDENTITY,
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top