How to add a null value to an existing SQL Server column?

I set up a table in SQL Server 2008 Express and forgot to add a non-zero constraint to my unique recordid column. I tried to add it later, with this statement:

 alter table movie_archive alter column RecordID Not null; 

but he gives me an error message saying a syntax error of "no." What am I doing wrong?

+4
source share
1 answer

specify the data type of the column

 ALTER TABLE [Table] ALTER COLUMN [Column] INTEGER NOT NULL; alter table movie_archive alter column RecordID INTEGER Not null; 
+11
source

Source: https://habr.com/ru/post/1490150/


All Articles