--修改字段为首字母大写

-- EXEC sp_rename 'ShenBao_CaiGouFuKuan.Tid', 'Tid', @objtype = 'COLUMN';

SELECT 'EXEC sp_rename ''' + TABLE_NAME + '.' + COLUMN_NAME + ''', ''' +
CONCAT(UPPER(LEFT(COLUMN_NAME,1)) , LOWER( RIGHT(COLUMN_NAME,len(COLUMN_NAME) - 1)))
+ ''', @objtype = ''COLUMN'';'
FROM INFORMATION_SCHEMA.COLUMNS
--WHERE TABLE_NAME='xxx';

执行查询语句得到  EXEC执行语句

05-11 22:28