Adsense

Thursday, April 18, 2013

How to tell what tables in a database are compressed

Run this query and then run the output of the query (remember to drop off the last union).


select 'select''' + name + ''' as dbnme, st.name, st.object_id, sp.data_compression_desc FROM ' + name + '.sys.partitions sp INNER JOIN ' + name + '.sys.tables st ON st.object_id = sp.object_id WHERE data_compression <> 0 union'
from master.sys.databases