MSSQL 테이블 정의서 작성에 도움이 되는 유용한 TIP 용 Query입니다.
select * from INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME in(select TABLE_NAME from INFORMATION_SCHEMA.TABLES)
example)
select
table_catalog, table_name, column_name, data_type,
CASE data_type
WHEN 'int' THEN numeric_precision
WHEN 'varchar' THEN character_maximum_length
WHEN 'datetime' THEN '8'
END
AS datatlength
,
column_default, is_nullable
from INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME in(select TABLE_NAME from INFORMATION_SCHEMA.TABLES)
order by TABLE_NAME, ORDINAL_POSITION