'Rename Column in Azure Data Warehouse

I know I can accomplish my objective with this process:

  1. Create new column
  2. Update new from old
  3. Drop old

I am looking for a way to do this with one command. I know that remane object works at the table level. For example, I can do this:

rename object Test.danPatient to dimPatient

But these all fail with various error messages:

rename object Test.dimPatient.City to Test.dimPatient.Town
rename object Test.dimPatient.City to Town
rename object DatabaseName.Test.dimPatient.City to Town
rename object DatabaseName.Test.dimPatient.City to DatabaseName.Test.dimPatient.Town

Plus, according to this, sp_rename is not supported by Azure Data Warehouse. My unsuccessful efforts to use it suggest that the web page is accurate.

Am I attempting the impossible?



Solution 1:[1]

sp_rename and column is now supported in Azure Synapse Analytics. So you can use:

sp_rename '[schema].[table].[old_column]', '[new_column]' , 'COLUMN';

Ref: link

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 wBob