'2012/05'에 해당되는 글 1건

  1. 2012.05.02 테이블 명세서 쿼리
개발 이야기/DB2012.05.02 12:16

테이블 명세서 쿼리

--컬럼

SELECT TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION, COLUMN_NAME, DATA_TYPE, ISNULL(CHARACTER_MAXIMUM_LENGTH, '') AS CHARACTER_MAXIMUM_LENGTH

, ISNULL(IS_NULLABLE, '') AS IS_NULLABLE, ISNULL(COLUMN_DEFAULT, '') AS COLUMN_DEFAULT

FROM INFORMATION_SCHEMA.COLUMNS

ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION


-- 테이블

SELECT TABLE_SCHEMA, TABLE_NAME

FROM INFORMATION_SCHEMA.COLUMNS 

GROUP BY TABLE_NAME, TABLE_SCHEMA

ORDER BY TABLE_SCHEMA, TABLE_NAME



-- 프로시져

SELECT * FROM sys.objects 

WHERE TYPE_DESC = 'SQL_STORED_PROCEDURE' 

AND NAME NOT LIKE 'sp_%' 

ORDER BY NAME


저작자 표시 비영리 변경 금지
신고
Posted by 사나에