>>I have 120 tables which have been migrated into SQL Server. It is so smart that within its Statistics option, it tells me about additional optimization I could benefit from. So, in there, I have seen so far 3 tables where at least one field could be indexed. This represents fields that we forgot to index in VFP. So, in order to see it, I have to open the Statistics section for each table. Is there a way to obtain that within one command?
>
>You can query the sys.stats and sys.stats_columns catalog views.
>
>SELECT object_name(s.object_id) AS TableName, COL_NAME(s.object_id, sc.column_id) AS ColumnName,
> *
> FROM sys.stats s
> JOIN sys.stats_columns sc ON s.object_id = sc.object_id AND s.stats_id = sc.stats_id
> WHERE object_name(s.object_id) NOT LIKE 'sys%'
> ORDER BY 1,2
>
That's much better than sp_HelpStats, thanks a lot.
If it's not broken, fix it until it is.
My Blog