Column Rename Example

1

Please login or register to vote for this query.

(click on this box to dismiss)

Column Rename Example

Programming Language Design and Implementation

Q&A for designers and implementers of computer programming languages

SELECT 'EXEC sp_rename ''' + TABLE_NAME + '.' + QUOTENAME(COLUMN_NAME) + ''', ''' + REPLACE(REPLACE(COLUMN_NAME, 'Count', 'Cnt'), 'View', 'Vw') + ''', ''COLUMN''; ' 
FROM INFORMATION_SCHEMA.COLUMNS 
WHERE COLUMN_NAME LIKE '%Count%' 
    OR COLUMN_NAME LIKE '%View%'

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results