Technical Article

Generated script to update statistics

,

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

Rate

3.33 (3)

You rated this post out of 5. Change rating

Share

Share

Rate

3.33 (3)

You rated this post out of 5. Change rating