Can't drop primary key?

  • Hi

    I'm struggling to drop a primary key.

    I get the error:

    An explicit DROP INDEX is not allowed on index 'MyTable.PrimaryKey'. It is being used for FOREIGN KEY constraint enforcement.

    "sp_helpindex MyTable", returns 1 entry:

    PrimaryKey, nonclustered, unique located on PRIMARY, ID

    I also tried:

    alter table MyTable DROP CONSTRAINT PrimaryKey

    I even went as far as dropping all primary keys and foreign keys on the entire database, but the error still pops up. Any ideas?

  • what results do you get when you run EXEC sp_fkeys myTable?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • OK - thanks. I found a couple of FK's, and I've removed it manually and it's working now.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply