Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Can't drop primary key? Expand / Collapse
Author
Message
Posted Tuesday, July 31, 2012 5:57 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, October 25, 2012 8:42 AM
Points: 5, Visits: 16
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?
Post #1337816
Posted Tuesday, July 31, 2012 5:59 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 2:03 PM
Points: 12,963, Visits: 32,512
what results do you get when you run EXEC sp_fkeys myTable?

Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1337818
Posted Tuesday, July 31, 2012 8:38 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, October 25, 2012 8:42 AM
Points: 5, Visits: 16
OK - thanks. I found a couple of FK's, and I've removed it manually and it's working now.
Post #1337947
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse