Renaming a SQL Column

Renaming a SQL Column

Can I rename a SQL column without making a new table or relying on GUI?

The ALTER TABLE ALTER COLUMN SYNTAX supports either dropping an existing column or altering the type. But it doesn’t allow you to change the name.

However, another command, sp_rename, will allow you to change the name of a column. It takes three arguments: the name of the object, the new name, and the object type.

Following is an example taken from the Books Online:

B. Rename a columnThis example renames the contact title column in the customers table to title.

EXEC sp_rename 'customers.[contact title]', 'title', 'COLUMN'

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular