How do you change the datatype of a column in SQL Server?

Ascalonian picture Ascalonian · Mar 9, 2009 · Viewed 686.1k times · Source

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

Answer

cmsjr picture cmsjr · Mar 9, 2009
ALTER TABLE TableName 
ALTER COLUMN ColumnName NVARCHAR(200) [NULL | NOT NULL]

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