SELECT 'DB명' as [DataBase명]
, c.[TABLE_NAME] AS [테이블명(물리명)]
, c.[COLUMN_NAME] AS [컬럼명(물리명)]
, (
CASE WHEN c.[CHARACTER_MAXIMUM_LENGTH] IS NOT NULL AND c.[DATA_TYPE] IN ('varchar', 'nvarchar', 'char')
THEN c.[DATA_TYPE] + '(' + CONVERT(VARCHAR, c.[CHARACTER_MAXIMUM_LENGTH]) + ')'
ELSE c.[DATA_TYPE] END
) AS [데이터타입]
, c.[IS_NULLABLE] AS [NULL여부]
FROM INFORMATION_SCHEMA.TABLES t
INNER JOIN INFORMATION_SCHEMA.COLUMNS c ON c.[TABLE_NAME] = t.[TABLE_NAME] AND t.[TABLE_TYPE] = 'BASE TABLE'
--WHERE c.[TABLE_NAME] IN ('TB_ORDER_TAXA')
where c.[COLUMN_NAME] = '필드명'
ORDER BY c.[TABLE_NAME]
댓글 없음:
댓글 쓰기