ALTER TABLE IF EXISTS test01
ADD CONSTRAINT pk1_test01 PRIMARY KEY (bz_bsncd, bz_ba_dcu_cd, bz_bsns_kndcd);
SELECT A.*
, B.*
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS A
, INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE B
WHERE 1=1 --A.TABLE_CATALOG = '데이터베이스명'
AND A.TABLE_NAME = 'test01'
AND A.CONSTRAINT_TYPE = 'PRIMARY KEY'
AND A.TABLE_CATALOG = B.TABLE_CATALOG
AND A.TABLE_SCHEMA = B.TABLE_SCHEMA
AND A.TABLE_NAME = B.TABLE_NAME
AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME
;
"table_name-2" "column_name"
"test01" "bz_ba_dcu_cd"
"test01" "bz_bsns_kndcd"
"test01" "bz_bsncd"
왜 다른 PK들은 문제가 없는데.... 위의 PK만 저렇게 다른 순서로 조회 되는지 모르겠네요....
|