Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
SQLDER
Starting Member
1 Post |
Posted - 2013-12-03 : 17:38:15
|
Using SQL SERVER 2008 R2:I have a table with 35 million records, one of the field is of datatype VARCHAR(MAX), it has well formed XML stored. Now we have to convert this column to XML data type. Trying 2 possible ways1) Creating new column with XML data type and updating that column using CAST(XMLFeildname as XML)-- taking a week to do so.2) Just altering table to change datatype to XML, this is also taking more 1 day.Please suggest an efficient way to do this faster.Thanks in advance. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2013-12-03 : 17:59:28
|
It only has 35 million rows, but I suspect that the row sizes are big.I think I would create an additional table with the proper layout. Create a view that unions both together. Use the view in the application while you migrate the data between the two tables. Have the insert to the new table and delete from the old table be in a transaction so that the data only appears in one location. Migrate the data in small batches. Loop until done. Then ditch the view.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|