You are here: Re: Changing data-types « MsSQL Server « IT news, forums, messages
Re: Changing data-types

Posted by Gert-Jan Strik on 09/04/07 20:18

Yes, it is safe, even though it will seriously impact server performance
during 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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация