January 25, 2011 at 3:15 pm
What is the easiest approach?
Many thanks for any input.
January 25, 2011 at 3:18 pm
What exactly do you want to remove?
Primary keys?
Foreign keys?
Unique Constraints?
All indexes?
And why?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 25, 2011 at 3:23 pm
You are right. Remove all indexes, contraints, ...
January 25, 2011 at 6:26 pm
I have written code that does just this, however, just like Gail I'd like to know the business case behind doing this. In addition, I am curious to know what you have done so far to sove this requirement. Are you stuck on something specific, what?
January 26, 2011 at 12:05 am
sys.indexes will get you a list of all of the indexes in a table.
sys.key_constraints will get you a list of all of the primary key and unique constraints, and what table that they are on.
sys.foreign_keys will get you a list of all of the foreign keys, and what table that they are on.
sys.default_constraints will get you a list of all of the default constraints, and what table that they are on.
sys.check_constraints will get you a list of all of the check constraints, and what table that they are on.
Until you answer Gail's question, I'll leave it up to you to figure out how to use this information. (But I bet that Lynn's routine will pretty much handle everything... you just gotta let us know why you want to do this.)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply