How to rename columns in an SQL-server database
-1
votes
1
answer
176
views
My employer has the habit of giving customer specific tables a name, starting with the name of the customer. This makes it difficult to call the
sp_rename
stored procedure for renaming column names, as you can see:
/*Version 1:*/
sp_rename 'Customer.FinishedProduct.ShortDescr', 'ShortDescription', 'COLUMN';
sp_rename 'Customer.LogTrackAndTrace.StorePreceddure', 'StoredProcedure', 'COLUMN';
/*Version 2:*/
sp_rename '[Customer.FinishedProduct].[ShortDescr]', '[ShortDescription]', 'COLUMN';
sp_rename '[Customer.LogTrackAndTrace].[StorePreceddure]', '[StoredProcedure]', 'COLUMN';
Both versions don't work.
Do you know how this can be written? (The name of a table is 'Customer.FinishedProduct'.)
Asked by Dominique
(609 rep)
Sep 13, 2023, 01:24 PM
Last activity: Jul 10, 2025, 02:05 PM
Last activity: Jul 10, 2025, 02:05 PM