Lollipop   

Welcome to PcCare.com

Sql Server Change Column Data type

Need customizations to this code? Call PcCare.com, sql server import/export experts.

 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.
 
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

PcCare.com is owned and operated by TechnoChill Inc.