I want to call a script/sproc at the beginning of a nightly ETL process that
will drop all indexes in a user-defined database.
At the end of the ETL process I will call a stored procedure (I already
have) to recreate the indexes.here's an undoc trick:
exec master..xp_execresultset N'select
''drop index ''+quotename(o.name)+''.''+quo_tename(i.name)
from sysindexes i join sysobjects o on i.id=o.id
where o.type=''U''
and i.indid > 0 and i.indid < 255
and (i.status & (32|64|2048|4096))=0
',N'Your_db_name_goes_here'
For more info on this trick:
http://rac4sql.net/xp_execresu_ltset.asp
-oj
"LP" <LP@.discussions.microsoft.com> wrote in message
news:FCD018BC-D7E2-446B-A49B-CF99FC3F160B@.microsoft.com...
>I want to call a script/sproc at the beginning of a nightly ETL process
>that
> will drop all indexes in a user-defined database.
> At the end of the ETL process I will call a stored procedure (I already
> have) to recreate the indexes.
>
Wednesday, March 7, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment