--修改欄位為首字母大寫 -- EXEC sp_rename 'ShenBao_CaiGouFuKuan.Tid', 'Tid', @objtype = 'COLUMN'; SELECT 'EXEC sp_rename ''' + TABLE_NAME + '.' + COLUMN_NAME + ' ...
--修改欄位為首字母大寫
-- 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執行語句