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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Removing index before a insert & add back after?

Author  Topic 

mgreen84
Yak Posting Veteran

94 Posts

Posted - 2014-06-05 : 13:46:59
How would I add in my script to remove my column indexes before my insert is ran, but then have them turned back on after the insert is complete?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-06-05 : 13:47:55
Script the DROP/CREATE INDEX statements out and add those to your script.

I am not sure why you'd want to do this though. How many rows are you inserting?

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2014-06-05 : 15:22:12
If you volume of data is so large that this would help, I'd suggest a DISABLE/ENABLE pattern. That way you don't lose any indexes that where dropped and, for whatever reason, not re-created.
Go to Top of Page

mgreen84
Yak Posting Veteran

94 Posts

Posted - 2014-06-05 : 16:04:24
Yeah Disabling is what I want to do not drop.

quote:
Originally posted by Lamprey

If you volume of data is so large that this would help, I'd suggest a DISABLE/ENABLE pattern. That way you don't lose any indexes that where dropped and, for whatever reason, not re-created.

Go to Top of Page
   

- Advertisement -