如何更改 SQL Server 中列的数据类型?

我正在尝试将一列从 varchar(50) 更改为 nvarchar(200).更改此表的 SQL 命令是什么?

I am trying to change a column from a varchar(50) to a nvarchar(200). What is the SQL command to alter this table?

推荐答案

ALTER TABLE TableName 
ALTER COLUMN ColumnName NVARCHAR(200) [NULL | NOT NULL]

编辑如前所述,应该指定 NULL/NOT NULL,参见 Rob 的回答.

EDIT As noted NULL/NOT NULL should have been specified, see Rob's answer as well.

相关文章