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 |
|
GavinD1977
Yak Posting Veteran
83 Posts |
Posted - 2007-05-30 : 05:40:39
|
Hello all.Could anyone advise me how to disable indexes on a specific table at the start of a script, then re-enable them at the end?Thanks all.  |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-05-30 : 06:18:44
|
| You can drop them at teh start and recreate them at the end==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2007-05-30 : 09:15:15
|
If you're using SS 2005, you can also use ALTER INDEX MyIndex ON MyTable DISABLE re-enabling it with ALTER INDEX MyIndex ON MyTable REBUILD See [url]http://msdn2.microsoft.com/en-us/library/ms177406.aspx[/url]Mark |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-05-30 : 13:44:00
|
| Why are you wanting to Disabled them?If its a bulk import OK, but if its anything else there might be a "Better Way" if we know what problem you are trying to solve ...Kristen |
 |
|
|
rakesh koyadi
Starting Member
3 Posts |
Posted - 2007-05-30 : 14:23:37
|
| Hi, In SS 2000 you need to check if index is existing first by searching in sysindexes table and then drop it at the start and then recreate it at the end. Directly dropping of an index may cause an error if it is not existing.Rakesh |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-05-30 : 16:22:01
|
| Don't disable clustered index in sql2k5. |
 |
|
|
|
|
|