How to add a not null to an already existing column in SQL Server?

alter-table, sql, sql-server

Solution

specify the datatype of the column

ALTER TABLE [Table] ALTER COLUMN [Column] INTEGER NOT NULL;

alter table movie_archive alter column RecordID INTEGER Not null;

Problem

I've setup a table in SQL Server 2008 Express and forgot to add a not null constraint to my unique `recordid` column. I tried to add it afterward, with this statement: ``` alter table movie_archive alter column RecordID Not null; ``` but it gives me an error message, saying there's a syntax error at "not". What am I doing wrong?

Original source

Related problems