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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alter Table stmt to add Primary key to existing field in tbl 1

Status
Not open for further replies.

Poduska

Technical User
Dec 3, 2002
108
US
I have a query which summarizes the data from about 20 tables which are created from individual make table queries. I am attempting to quicken up my final query by adding primary keys to the tables which are created by make table queries. This all happens in a macro so I want to keep the process automated.
Why the many make tables? I am using Access to pull data from many Oracle tables and create one master table for our users.

I have been trying this SQL

Code:
ALTER TABLE table1  ALTER COLUMN item add constraint primary key

I am just trying to get the statement to work on a sample table called Table1 and a field called Item which I want to place the index.

Using this Microsoft link as a guide. However all I get is a syntax error.

What SQL could I add to create the primary key.
 
And what about this ?
CREATE UNIQUE INDEX PrimaryKey ON table1 (item) WITH PRIMARY

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Wow, was I on the wrong track.
Your SQL worked perfect, thanks.

I need to study up a bit on that syntax.

Tek-Tips saves me again!

Star to PHV!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top