Adding NOT NULL column without default value

Adding a NOT NULL column without a DEFAULT value to an existing table that already contains data will fail, because SQL Server has no way of adding that column to the existing rows, as there must be a value in the column.

Available in

SQL Prompt

SQL Code Guard

Didn't find what you were looking for?