Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Plaease! Creating a table with unique index

Status
Not open for further replies.

Luke71

Programmer
Feb 8, 2006
1
IT
I'm writing a C# program which creates a MS Access database by "Create table..."
Can you tell me how creating an index as primary key? It should be an automatic indexer, updating itself if I delete a record or I insert a new one..which syntax should I use?
Thanks,
Luke
 
CREATE TABLE in Jet SQL takes the form:

CREATE [TEMPORARY] TABLE table (field1 type [(size)] [NOT NULL] [WITH COMPRESSION | WITH COMP] [index1] [, field2 type [(size)] [NOT NULL] [index2] [, ...]] [, CONSTRAINT multifieldindex [, ...]])


Alternatively there's also the CREATE INDEX statement which takes the form:

CREATE [ UNIQUE ] INDEX index
ON table (field [ASC|DESC][, field [ASC|DESC], ...])
[WITH { PRIMARY | DISALLOW NULL | IGNORE NULL }]

Hope this helps.

[pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top