_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 糾覲願葦

一危磯伎れ 企 譴 21% 伎 row螳 企磯 糾 覲願 一危 蟆...
set nocount on
set statistics io off

declare 
	@tname varchar(255)
,	@sql varchar(2000); 

declare cur cursor for
	select distinct
		c.name + '.' + object_name(b.object_id)
	from sys.sysindexes a
		inner join sys.objects b 
			on a.id = b.object_id
		inner join sys.schemas c
			on b.schema_id = c.schema_id
	where a.rowcnt / a.rowmodctr * 100 >= 21
	and a.rowmodctr > 0
	and a.id > 100
	and a.rowcnt > 1000000
	and c.name not in ('temp')
	and b.type = 'U'

open cur;
fetch next from cur into @tname;
while @@FETCH_STATUS not in (-1, -2)
begin

	set @sql = 'update statistics ' + @tname
	exec(@sql)
	print @sql
		
	fetch next from cur into @tname;
end

close cur;
deallocate cur;
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

覓伎瑚襯 企り 襷 る 語 企襯 螳 螳 螳 . 覓伎 れ 襷 蟇一 讌 れ . (れ梗)