- /**********************************************************************************************
-- Title : [2k5] 인덱스된 열 이름 찾기 - -- Reference : dbrang.com
-- Key word : 인덱스된 컬럼 이름 indexed column index_col
**********************************************************************************************/ - use tempdb;
- create table dbo.test
( a int not null, b int not null, c int not null
, constraint pk_dbo_test primary key (a, b)
); - create schema ttt;
- create table ttt.test
( a int not null, b int not null, c int not null
, constraint pk_ttt_test primary key (b, c)
); - -- 2k5 : INDEX_COL ( '[ database_name . [ schema_name ] .| schema_name ], table_or_view_name', index_id , key_id )
-- 2k : INDEX_COL ( 'table' , index_id , key_id )
select index_col('dbo.test', 1, 1) union all
select index_col('dbo.test', 1, 2) union all
select index_col('dbo.test', 1, 3) union all
select index_col('ttt.test', 1, 1) union all
select index_col('ttt.test', 1, 2) union all
select index_col('ttt.test', 1, 3);
/*
a
b
NULL
b
c
NULL
*/ - drop table dbo.test, ttt.test;
drop schema ttt;
[2k5] 인덱스된 열 이름 찾기
2008. 9. 6. 23:06