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 |
inbs
Aged Yak Warrior
860 Posts |
Posted - 2013-11-12 : 01:37:30
|
how do i execute this query (i try to insert it in parameter varchar(max) but it small?select 'alter index ' +i.name+ ' on ' +o.name+ ' disable ' + CHAR(13)+Char(10)+';' From sys.indexes i Inner Join sys.objects o On o.object_id = i.object_id Where o.is_ms_shipped = 0 And i.index_id >= 1 AND o.NAME LIKE '%Fact%' |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-11-12 : 01:38:41
|
COPY the RESULT of this QUERY and PASTE into a new QUERY WINDOW and EXECUTE KH[spoiler]Time is always against us[/spoiler] |
|
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2013-11-13 : 02:42:02
|
but i want to run it in the jobthanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-11-13 : 04:13:27
|
[code]declare @sql nvarchar(max)select @sql = isnull(@sql, '') + 'alter index ' +i.name+ ' on ' +o.name+ ' disable ' + CHAR(13)+Char(10)+';'From sys.indexes iInner Join sys.objects oOn o.object_id = i.object_idWhere o.is_ms_shipped = 0And i.index_id >= 1AND o.NAME LIKE '%Fact%'exec (@sql)[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
|
|
|