When modifying a table SQL Server (2005) and unchecking a column's 'Allow Nulls' (ie trying to make the column Not Null) the following error may occur:
'<tablename>' table
- Unable to modify table.
Cannot insert the value NULL into column '<columnname>', table '<dbname>.dbo.Tmp_<tablename>'; column does not allow nulls. INSERT fails.
The statement has been terminated.
This occurs if there is already data in this table and this column contains nulls.
The solution is to simply update the data in this table so that this column does not contain nulls then change the column to not null. eg if this column was of type int you could do this:
UPDATE [<dbname>].[dbo].[<tablename>]
SET [<integercolumnname] = -1