DROP AND CREATE PRIMARY KEY

  • Thread starter Thread starter Anwar
  • Start date Start date
A

Anwar

Hi,
I am trying to drop and add primary key of table

I tried both of following statementd, none of the
following worked,

ALTER TABLE TableName DROP PRIMARY KEY(PrimaryKeyIndexName)
ALTER TABLE TableName DROP PRIMARY KEY

Your help will be very appriciated

Thanks
 
ALTER TABLE TableName DROP PRIMARY KEY(PrimaryKeyIndexName)

The primary key is a form of contraint; you'll have to find out what it's
called if you didn't write the original create table command. I think
Access usually uses either "[Primary Key]" or "PrimaryKey", but you'd need
to look in the Indexes collection.

alter table tablename drop constraint WhatEverYouCalledThePKConstraint;

Hope that helps


Tim F
 
Back
Top