Users Pricing

blog

home / developersection / blogs / changed data type of column in sql server

Changed Data Type of column in SQL Server

AVADHESH PATEL 3851 31 Dec 2012 Updated 18 Sep 2014

In this blog I have described how to changed data type of existing column of table. For demonstration, I have used a table that given below.

CREATE TABLE [dbo].[EmpInfo]
(
[ID] INT IDENTITY PRIMARY KEY,
[Name] VARCHAR(50),
[Date] VARCHAR(50)
)


Syntax:

ALTER TABLE <Table Name> ALTER COLUMN <Column Name> <New Data Type> <Size Depend on Data Type>


Example:
ALTER TABLE [dbo].[EmpInfo]
ALTER COLUMN [DATE] DATETIME

Avadhesh Kumar Patel District Project Manager - Aligarh 14 months work experience in Panchayati Raj Department Sector as District Project Manager & 12 months work experience in IT Sector as Software Engineer. :-)