I apologize in advance if this is something obvious I've missed ... fresh eyes/brain and all that.
If I have a table that is using a particular partition scheme/function, is there a quick and easy way to determine which column of that table is being used for partitioning? We're examining a number of legacy structures and we're hoping to reduce the time it's going to take us to get the report management wants.
Thanks.
The partition column information is saved in sys.index_columns catalog view. use the following script to check the partition scheme and column:
select c.name AS PartitionColumn,ic.partition_ordinal AS PartitionColOrder,dsidx.[name] AS PartitionScheme
from sys.indexes AS idx, sys.columns c,
sys.index_columns ic, sys.data_spaces AS dsidx
where idx.[object_id]=object_id('dbo.YouTable')
and idx.index_id<2
and idx.[object_id]=ic.[object_id]
and idx.index_id=ic.index_id
and dsidx.data_space_id = idx.data_space_id
and dsidx.type=N'PS'
and c.object_id=ic.[object_id]
and c.column_id=ic.column_id
and ic.partition_ordinal>0
No comments:
Post a Comment