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.
Author |
Topic |
ferrethouse
Constraint Violating Yak Guru
352 Posts |
Posted - 2010-04-25 : 12:53:21
|
Anyone know of a script I can run that will generate create scripts for all indexes in a database? |
|
ferrethouse
Constraint Violating Yak Guru
352 Posts |
Posted - 2010-04-25 : 13:21:56
|
quote: Originally posted by ferrethouse Anyone know of a script I can run that will generate create scripts for all indexes in a database?
If the script also created a drop script for all existing indexes too that would be super! |
 |
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2010-04-25 : 13:47:23
|
What are you trying to accomplish? It might be easier to just disable the indexes - then rebuild them when you are done. Note: you cannot disable the clustered index and have the table accessible. To disable all non-clustered indexes, take a look at the system view sys.indexes. You can identify the user tables - and the type of index and build a statement to disable. |
 |
|
ferrethouse
Constraint Violating Yak Guru
352 Posts |
Posted - 2010-04-26 : 01:02:43
|
I'm running the database advisor with the option to drop existing indexes enabled. I want to script my existing indexes just in case the database adviser is wrong I will be able to drop all the indexes it created and restore all of my old ones from the script. |
 |
|
|
|
|