在MSSQL中,我在分区表上有索引,当它等于零时我不明白属性key_ordinal
的含义。
要创建索引,分区方案基于CUT_OFF。
create table dbo.TESTTB (CUT_OFF datetime, number int) on partscheme(CUT_OFF);
create index TESTIX on dbo.TESTTB (number) on partscheme(CUT_OFF);
查询显示 key_ordinal 的值:
select c.name as column_name, b.key_ordinal
from sys.indexes a
inner join sys.index_columns b
on a.object_id = b.object_id and a.index_id = b.index_id
inner join sys.all_columns c on b.object_id = c.object_id
and b.column_id = c.column_id
where a.name = 'TESTIX'
结果是:
column_name key_ordinal
CUT_OFF 0
number 1
列 CUT_OFF :
sys.index_columns
中显示 key_ordinal = 0 Create Index
声明sp_help 'TESTTB'
0 =不是键列,或者是XML索引,列存储索引或者 空间索引。
这意味着什么? 什么是 key_ordinal = 0 ?
由于