How to add Add column, rename column, or update column data types in sql server:
Add a new column into the table
Syntax:
ALTER TABLE Table_Name
ADD column_name datattype;
Note: Newly added column will only be added at the end of the table columns.
Modify a table- drop column name:
Syntax:
ALTER TABLE table_name
DROP COLUMN column_name;
How to rename a column in SQL Server:
EXEC sp_RENAME 'TestTabl1.OldColumnRecordId', 'NewColumnName', 'COLUMN'
Query should get successfully get executed. and also if the table is already populated
you would get a warning message like:
Caution: Changing any part of an object name could break scripts and
stored procedures.