Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Update statistics in all databases Expand / Collapse
Author
Message
Posted Monday, April 12, 2010 7:43 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, June 20, 2013 6:53 PM
Points: 3, Visits: 133
Comments posted to this topic are about the item Update statistics in all databases
Post #902093
Posted Friday, April 16, 2010 8:50 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, January 13, 2012 11:37 AM
Points: 4, Visits: 34
Why not use sp_updatestats?
Post #904920
Posted Friday, April 16, 2010 10:14 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, June 20, 2013 6:53 PM
Points: 3, Visits: 133
Because sp_updatestats just update statistics in all tables in the current database.
Post #905034
Posted Friday, April 16, 2010 2:14 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, January 13, 2012 11:37 AM
Points: 4, Visits: 34
Ha! I must not have had my first cup of coffee before making that post. Good call.
Post #905194
Posted Saturday, April 17, 2010 6:01 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, June 20, 2013 6:53 PM
Points: 3, Visits: 133
No problem. Thanks for your message.
Post #905389
Posted Sunday, April 18, 2010 6:52 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, September 7, 2012 1:18 AM
Points: 184, Visits: 156
Hi,

I have some databases with spaces in the names and so I added some square brackets;

USE master
go

exec sp_MSforeachdb
' IF (''?'' NOT IN (''master'',''tempdb'',''model'',''msdb'',''ReportServerTempDB''))
BEGIN PRINT ''Atualizando estatísticas de '' + ''?''
use [?] exec sp_updatestats END';

Thanks for the useful snippet!
Post #905635
Posted Sunday, April 18, 2010 7:33 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, June 20, 2013 6:53 PM
Points: 3, Visits: 133
Very good. In fact, this is necessary. Thanks.
Post #905644
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse