Advertisement
tei219

update statistics

Jan 20th, 2012
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.33 KB | None | 0 0
  1. exec sp_MSforeachdb @command1 = '
  2.     use [?]
  3.     print ''?''
  4.     if ''?'' not in (''tempdb'', ''model'')
  5.     exec sp_MSforeachtable @replacechar = ''~'', @command1 = ''
  6.         if exists ( select * from sysobjects where type = ''''U'''' and id = object_id(''''~'''') )
  7.         begin
  8.             print ''''~''''
  9.             update statistics ~ with fullscan
  10.         end
  11.     ''
  12. '
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement