SQL Server > Table

Alter existing column type in SQL Server

How to alter table and alter column in SQL Server?

In previous post, we learnt how to add a new column into existing Sql Server database table. In this post, we shall learn how to alter/modify an existing column of a SQL Server database table.

To do that write following query where highlighted words are not keywrods ie we need to change as per our need.

ALTER table MyDetails
Alter column City varchar(100)

Above query translates like

  1. Line 1 - instruct that we are going to later table "MyDetails".
  2. Line 2 - instruct that we are going to alter column named "City" and are going to change the data type to "varchar" and lenght to "100".
 Views: 1561 | Post Order: 20

Write for us