Monthly Archives: August 2014

Update the statistics to all tables in a database WITH FULLSCAN


DECLARE @SQL NVARCHAR (MAX) DECLARE C1 CURSOR FOR SELECT DISTINCT ‘UPDATE STATISTICS [dbo].[‘+o.name +’] WITH FULLSCAN ‘ FROM sys.objects AS o WITH (NOLOCK) INNER JOIN sys.indexes AS i WITH (NOLOCK) ON o.[object_id] = i.[object_id] INNER JOIN sys.stats AS s WITH … Continue reading

Posted in Uncategorized | Leave a comment