Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
How to change the data type of the column in SQL
3277 Views
Hints 
alter column query used to change the datatype of existing column.Table has columns and rows structure.When creating a column given parameters are column names and its datatype, size of the column.

In the following example you can able to see the parameters.Data types -int,nvarchar,varchar,datetime,double etc..,
Syntax
alter table tableName
alter column columnName dataType(size);
Example
Using ALTER TABLE statement,
change the data type of the column shipregion from INTEGER to CHARACTER with length 8.
The fields may contain null values.

alter table Orders
alter column shipregion char(8);
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details