원문 : http://www.ischo.net -- 조인상 //시스템 엔지니어

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

MS-SQL에서 전체 테이블리스트 + 테이블당 스키마구조 긁어오는 Query


 

select cl.TABLE_NAME as [TABLE], cl.COLUMN_NAME as [NAME], cl.IS_NULLABLE as [ISNULL], cl.DATA_TYPE as [TYPE], cl.CHARACTER_MAXIMUM_LENGTH as [LENGTH], kcu.COLUMN_NAME AS [KEYS], kcu.ORDINAL_POSITION as [POSITION]
from INFORMATION_SCHEMA.COLUMNS cl LEFT OUTER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu
on cl.TABLE_NAME = kcu.TABLE_NAME and cl.COLUMN_NAME = kcu.COLUMN_NAME and cl.ORDINAL_POSITION = kcu.ORDINAL_POSITION;

 

 

 

 

(*.158.142.101)