SELECT ', @P_' + COLUMN_NAME + SPACE(10) + CASE DATA_TYPE WHEN 'varchar' THEN UPPER(DATA_TYPE) + '(' + CAST(CHARACTER_MAXIMUM_LENGTH AS VARCHAR(MAX)) + ')'
WHEN 'numeric' THEN CASE WHEN NUMERIC_SCALE > 0
THEN UPPER(DATA_TYPE) + '(' + CAST(NUMERIC_PRECISION AS VARCHAR(2)) + ',' + CAST(NUMERIC_SCALE AS VARCHAR(1))
ELSE UPPER(DATA_TYPE) + '(' + CAST(NUMERIC_PRECISION AS VARCHAR(2)) + ')'
END
END
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @TABLE_NAME AND DATA_TYPE IN ('varchar', 'numeric', 'char')
ORDER BY ORDINAL_POSITION
SP 개발 진행시 주의사항 (0) | 2015.05.22 |
---|---|
MS SQL SERVER LOCK (0) | 2015.04.20 |
음/양 변환 데이타 (0) | 2015.03.20 |
MS-SQL Try Catch (0) | 2015.01.15 |
MS-SQL Table List 및 Column 정보 불러오기 (0) | 2015.01.15 |