I SQL Server kan du använda följande fråga för att bestämma partitioneringskolumnen för en partitionerad tabell.
SELECT
t.name AS [Table],
c.name AS [Partitioning Column],
TYPE_NAME(c.user_type_id) AS [Column Type],
ps.name AS [Partition Scheme]
FROM sys.tables AS t
JOIN sys.indexes AS i
ON t.[object_id] = i.[object_id]
AND i.[type] <= 1
JOIN sys.partition_schemes AS ps
ON ps.data_space_id = i.data_space_id
JOIN sys.index_columns AS ic
ON ic.[object_id] = i.[object_id]
AND ic.index_id = i.index_id
AND ic.partition_ordinal >= 1
JOIN sys.columns AS c
ON t.[object_id] = c.[object_id]
AND ic.column_id = c.column_id
WHERE t.name = 'Movies';
Resultat:
+---------+-----------------------+---------------+-----------------------+ | Table | Partitioning Column | Column Type | Partition Scheme | |---------+-----------------------+---------------+-----------------------| | Movies | MovieId | int | MoviesPartitionScheme | +---------+-----------------------+---------------+-----------------------+
Se till att byta Movies
med ditt bordsnamn.
I mitt fall är partitioneringskolumnen MovieId och det är en int typ.