0

I have an existing column of data type varchar that I need to change to nvarchar, however I do not want to alter the existing column width of (5).

If I use the following statement

ALTER TABLE MYTABLE ALTER COLUMN MYCOLUMN NVARCHAR (5) NOT NULL

I end up with a column of nvarchar data type, but with a column width of (10)!

If I try the following statement without specifying a column width

ALTER TABLE MYTABLE ALTER COLUMN MYCOLUMN NVARCHAR (5) NOT NULL

I then end up with an nvarchar column with a width of (2)

How can I simply change the column data type from varchar to nvarchar without affecting the existing column width?

Thank you!

4

1 回答 1

1

NVARCHARUNICODE UCS-2类型,设计宽度为 的两倍VARCHAR

请仔细阅读SQL Server 联机丛书,以了解 SQL 数据类型之间的区别。我已经包含了一个链接

于 2009-10-22T08:21:42.847 回答