Skip to content

Instantly share code, notes, and snippets.

@ghotz
Created October 22, 2018 10:17
Show Gist options
  • Save ghotz/29f8e08f76fdcd184047957bdf0c87ad to your computer and use it in GitHub Desktop.
Save ghotz/29f8e08f76fdcd184047957bdf0c87ad to your computer and use it in GitHub Desktop.
Get info about temp table statistics
SELECT S1.name AS stats_name, C1.name AS column_name
FROM tempdb.sys.stats AS S1
JOIN tempdb.sys.stats_columns AS S2
ON S1.object_id = S2.object_id
AND S1.stats_id = S2.stats_id
JOIN tempdb.sys.all_columns AS C1
ON S2.object_id = C1.object_id
AND S2.column_id = C1.column_id
WHERE S1.[object_id] = OBJECT_ID('tempdb..#ftplog_t_dati_1')
ORDER BY
S1.[name], S2.stats_column_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment