How to modify a SQL Server table ? With the SQL Server Alter Table command, modify an existing table. The ALTER TABLE SQL Server query helps you update an already existing table. The example script below allows you to modify the Sales table previously created, by changing the length of the Month Name column. Of course you need to adapt it to your needs.
Moreover, the ALTER keyword in SQL allows you to add a column or remove a column. Use the ALTER twice: the first time to specify the target table and the second time to specify the column to change.
How to modify a SQL Server table?
We can see in the script the two lines, one is ALTER TABLE and the other keyword ALTER COLUMN to explicitly change the length of the column.
ALTER TABLE [dbo].[SALES] ALTER COLUMN [MonthName] NVARCHAR(100); -- we change the length to 100, initially 50
So in the Expert-Only SQL Server tables scripts, we have seen previously how to create a table and now how to modify a SQL table, to go further, check this article on how to delete a SQL Server table.