|  | Posted by Gert-Jan Strik on 09/04/07 20:18 
Yes, it is safe, even though it will seriously impact server performanceduring the conversion, cost a lot of log space (temporarily). Also, you
 should expect serious growth of the required space for the table, expect
 the current table size * 2.
 
 BTW, the simple test below proves the change is safe.
 
 CREATE TABLE Test (a varchar(255))
 INSERT INTO Test VALUES ('a')
 INSERT INTO Test VALUES (REPLICATE('b',255))
 INSERT INTO Test DEFAULT VALUES
 SELECT * FROM Test
 go
 ALTER TABLE Test ALTER COLUMN a nvarchar(255)
 go
 SELECT * FROM Test
 DROP TABLE Test
 
 --
 Gert-Jan
 
 
 Danny wrote:
 >
 > Hi All,
 >
 > I have a varchar(255) column for storing text in english and in
 > hebrew.
 > It was a stupid mistake to set the data type to be varchar, because
 > now I need to store text in german and francais too.
 >
 > Question: Is it safe to change the data type from varchar to nvarchar,
 > without damaging the data that's already present?
 > (I have more than 1000000 records stored...)
 >
 > Thanks,
 > Danny
  Navigation: [Reply to this message] |