Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Removing cluster index without dropping primary k

Author  Topic 

sql_buddy
Starting Member

41 Posts

Posted - 2009-07-06 : 05:16:53
i want to remove cluster index from primary key ,without dropping primary key as
for dropping primary key i have to
remove all foreign key constraints
then drop primary key
add primary key with non clustered index and then
add foreign keys constraints

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2009-07-06 : 06:46:02
If the clustered index is enforcing the primary key (ie it was created by creating the primary key), it cannot be dropped without dropping the primary key.

You are correct in the procedure that you'll have to follow to make the pk nonclustered.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

sql_buddy
Starting Member

41 Posts

Posted - 2009-07-06 : 08:02:56
can i find all the foreign key constraints assosciated to a table'primarykey
using script
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-06 : 08:09:59
sp_depends OR in future
sys.dm_sql_referencing_entities and sys.dm_sql_referenced_entities.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-06 : 08:13:29
In SSMS right click on table name and choose 'view dependencies'.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2009-07-06 : 08:18:22
or use SYS.FOREIGN_KEY_COLUMNS
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-07-06 : 13:01:39
or tell us what version you are using


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -