SELECT A.TABLE_SCHEMA AS [ 스키마 ] ,A.TABLE_NAME AS [ 테이블명 ] ,A.COLUMN_NAME AS [ 컬럼명 ] ,B.COLUMNDESCRIPTION AS [ 컬럼 설명 ] ,A.ORDINAL_POSITION AS [ 순서 ] ,A.DATA_TYPE AS [ 데이터 타입 ] ,CASE WHEN A.CHARACTER_MAXIMUM_LENGTH IS NULL THEN ISNULL(A.NUMERIC_PRECISION, '') ELSE A.CHARACTER_MAXIMUM_LENGTH END AS [ 길이 ] ,A.IS_NULLABLE AS [ NULL 여부 ] ,ISNULL(A.COLUMN_DEFAULT, '') AS [ 디폴트 값 ] FROM INFORMATION_SCHEMA.COLUMNS AS A WITH(NOLOCK) INNER JOIN ( SELECT A.NAME AS TABLENAME ,B.NAME AS COLUMNNAME ,C.VALUE AS COLUMNDESCRIPTION FROM SYS.TABLES AS A WITH(NOLOCK) INNER JOIN SYS.COLUMNS AS B WITH(NOLOCK) ON A.OBJECT_ID = B.OBJECT_ID LEFT OUTER JOIN SYS.EXTENDED_PROPERTIES AS C WITH(NOLOCK) ON A.OBJECT_ID = C.MAJOR_ID AND B.COLUMN_ID = C.MINOR_ID ) AS B ON A.TABLE_NAME = B.TABLENAME AND A.COLUMN_NAME = B.COLUMNNAME WHERE A.TABLE_NAME = 'TEST';
728x90
반응형
'DB > Mssql' 카테고리의 다른 글
mssql 쿼리 실행계획 텍스트 형식 (0) | 2018.01.13 |
---|---|
mssql 엑셀파일 읽기 (0) | 2018.01.13 |
mssql 테이블 설명 코멘트 생성 (0) | 2018.01.11 |
mssql 테이블 명세서 조회 (0) | 2018.01.09 |
mssql 시퀀스 지정 방법 (0) | 2018.01.09 |