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

Primary Key Constraint Name

Status
Not open for further replies.

swstran

MIS
Feb 1, 2001
6
US
Is it possible to drop primary key of an Access table using SQL? What I really meant was that the ALTER TABLE DROP CONSTRAINT statement can be used to drop a primary key, but it requires the constraint name. Since our primary key was created within Access, we don't know what is the constraint name that system had assigned.
 
In Access, the constraint name is supposed to be the same as the index name. For primary keys, the default is always "PrimaryKey". You can check it by opening the table in Design View, then choosing View>Indexes from the menu.

I've never actually done this. Let me know if it works. Rick Sprague
 
Thanks Rick,

It works just beautiful the way I wanted. Now I can apply the followings:

ALTER TABLE <table_name> DROP CONSTRAINT PrimaryKey

and this will drop the primary key created by MS Access.

Again, thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top