Skip to main content
3 of 4
added 3 characters in body
Matas Vaitkevicius
  • 61.9k
  • 37
  • 253
  • 278

You will have to do it in two steps:

  1. Update the table so that there are no nulls in the column.

    UPDATE MyTable SET MyNullableColumn = 0 WHERE MyNullableColumn IS NULL

  2. Alter the table to change the property of the column

    ALTER TABLE MyTable ALTER COLUMN MyNullableColumn MyNullableColumnDatatype NOT NULL

Ralph Wiggum
  • 699
  • 1
  • 6
  • 10