Tuesday, May 22, 2012

Find auto-created SQL Server statistics


Based on workload SQL server will create statistics on various columns of tables. Use following script to find out auto-created statistics by SQL Server.

SELECT name, OBJECT_NAME(OBJECT_ID)
FROM sys.stats
WHERE auto_created = 1 and OBJECT_NAME(OBJECT_ID) like 'TableName';

Following command will remove statistics on a perticular table

DROP STATISTICS TableName.StatisticsName

No comments:

Post a Comment