Showing posts with label Best way to change the datatype of Column of Table. Show all posts
Showing posts with label Best way to change the datatype of Column of Table. Show all posts

Friday, June 14, 2013

[SQL Server Data Warehousing] Best way to change the datatype of Column of Table


Best way to change the datatype of Column of Table



Are you allowed any sort of outage on this table?  If so, then consider creating a new table with the correct data type, bulk load the data into it, then drop the old table and rename the new.  I don't think 5m records is a significant enough volume to warrant any more complex a solution. 


You can also do an ALTER TABLE/ALTER COLUMN query, as long as the data types you are converting from and to are compatible, and the data is compatible.  That's assuming the column is not part of the primary key or part of an index or constraint. 



.

social.technet.microsoft.com/Forums

Search This Blog