SQL:主约束索引
SQL SERVER 主约束索引
--主约束索引 SELECT OBJ.OBJECT_ID AS [TABLE_ID], OBJ.NAME AS [TABLE_NAME], PK.name AS CONSTRAIN_NAME, idx.name as index_name, IDXC.index_column_id, IDXC.key_ordinal, COL.name AS COLUMN_NAME FROM SYS.all_objects OBJ, SYS.key_constraints PK, sys.indexes idx, sys.index_columns idxc, SYS.all_columns COL WHERE OBJ.type='U' AND OBJ.name LIKE 'AP_Vouch' AND OBJ.object_id = PK.parent_object_id AND PK.type='PK' and pk.parent_object_id = idx.object_id and pk.unique_index_id = idx.index_id AND IDX.object_id = IDXC.object_id and idx.index_id = idxc.index_id AND IDXC.object_id = COL.object_id and IDXC.column_id = COL.column_id
优质生活从拆开始