1 Articles, Search for '테이블'

  1. 2009/01/16 [SQLServer]특정테이블의 컬럼정보 가져오기
DATABASE/SQLServer2009/01/16 17:08
-- 특정테이블의 컬럼정보가져오기
select *
FROM INFORMATION_SCHEMA.COLUMNS
where table_name = 'Customer'
order by table_name,ordinal_position

-- 특정테이블의 PK정보가져오기
select constraint_name from information_schema.table_constraints
where constraint_type='PRIMARY KEY'
   and table_name = 'Customer'

-- 특정테이블의 FK정보가져오기
select constraint_name from information_schema.table_constraints
where constraint_type='FOREIGN KEY'
   and table_name = 'Customer'
크리에이티브 커먼즈 라이센스
Creative Commons License
2009/01/16 17:08 2009/01/16 17:08
Posted by

Leave your greetings.