简体   繁体   English

在SQL Server中将文本数据类型更改为nvarchar(max)是否安全?

[英]Is it safe to change text datatype to nvarchar(max) in SQL Server

I have an old SQL Server database that till uses the text datatype. 我有一个旧的SQL Server数据库,直到使用text数据类型。 I would like to change this to nvarchar(max) to allow for emojis and other modern stuff. 我想将其更改为nvarchar(max)以允许表情符号和其他现代内容。

Is it safe to just change the database? 仅更改数据库是否安全? Or is it safer to create a new nvarchar(max) column and update all rows to copy data from the old column to the new? 还是创建一个新的nvarchar(max)列并更新所有行以将数据从旧列复制到新列是否更安全?

Just change the database using ALTER TABLE ... ALTER COLUMN 只需使用ALTER TABLE ... ALTER COLUMN更改数据库

Just in case anyone mentions it, there were some old edge cases where data was lost or changed, but these have been patched ( MS KB 968914 for example) 以防万一有人提及它,在某些较旧的边缘情况下,数据丢失或更改,但已对其进行了修补(例如, MS KB 968914

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM