Lollipop

Welcome to PcCare.com

Sql Server Change Column Data type

 

 Start->Microsoft SQL Server 2008->SQL Server management Studio

 

Menu->File->Connect Object Explorer

 

Use Object Explorer to open Database and table

 

Right click the table name and chose script table as->Create to->New Query window

 

Change the data type of your date fieild from nvchar to DateTime

"[Date] [datetime] NULL,". remove any field length settings.

 

Save the create table sql for later use.

 

Enter the following sql statement to delete the existing table

 

Drop table tablename

 

*** Warning *** all table data will be lost when the table is dropped, perform backup before execution.

 

Re-execute the Create table script to create a new table with the updated column data type.

 

USE [SysCheckOut]

 

GO

 

/****** Object: Table [dbo].[SigCheck] Script Date: 03/21/2009 13:14:40 ******/

 

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[SigCheck](

 

[Path] [nvarchar](200) NULL,

 

[Verified] [nvarchar](50) NULL,

 

[Date] [datetime] NULL,

 

[Publisher] [nvarchar](400) NULL,

 

[Description] [nvarchar](400) NULL,

 

[Product] [nvarchar](400) NULL,

 

[Version] [nvarchar](50) NULL,

 

[File version] [nvarchar](50) NULL,

 

[Original name] [nvarchar](400) NULL,

 

[Internal name] [nvarchar](400) NULL,

 

[Copyright] [nvarchar](400) NULL,

 

[Comments] [nvarchar](400) NULL,

 

[MD5] [nvarchar](50) NULL,

 

[SHA1] [nvarchar](400) NULL,

 

[SHA256] [nvarchar](600) NULL

) ON [PRIMARY]

 

GO

 

 

 

 

 

 

 

DISCLAIMER: It is assumed that users are familiar with the operating system they are using and comfortable with making the suggested changes. PcCare.com will not be held responsible if changes you make cause a system failure.

Please review our Terms of Service and Privacy statement before initiating service or using this site. Microsoft® and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. PcCare Site Map. About Us