Generated script to update statistics
2016-06-15
1,228 reads
Generated script to update statistics
---Objetivo: Generated script to update statistics ---Fecha:09/04/2014 ---Autor: Andrés Noé Michaca Trujillo use Database go declare @SQL nvarchar(1000) declare cursor_estadisticas cursor for select 'UPDATE STATISTICS ' + ltrim(rtrim(b.name))+'.'+ltrim(rtrim(a.name))+ ' with fullscan;' from sys.sysobjects a inner join sys.schemas b on a.uid=b.schema_id where a.xtype='U' open cursor_estadisticas fetch cursor_estadisticas into @sql WHILE @@FETCH_STATUS = 0 Begin print @SQL print 'go' fetch cursor_estadisticas into @sql end close cursor_estadisticas deallocate cursor_estadisticas