Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting it all from Statistics
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01302337
Message ID:
01302635
Views:
10
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform