DECLARE @TSQL nvarchar(2000)
ย
-- Filtering system databases and user databases from execution
SET @TSQL = '
IF (DB_ID(''?'') > 4
ย AND ''?'' NOT IN(''distribution'',''SSISDB'',''ReportServer'',''ReportServertempdb'')
ย )
BEGIN
ย PRINT ''********** Rebuilding statistics on database: [?] ************''
ย USE [?]; exec sp_updatestats
END
'
-- Executing TSQL for each database
EXEC sp_MSforeachdb @TSQL
Comments
0 B
|๐
/๐
0 B
|๐
/๐