Skip to main content
deleted 2 characters in body
Source Link
user4447799
user4447799

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

    Update the table so that there are no nulls in the column.
UPDATE MyTable SET MyNullableColumn = 0
WHERE MyNullableColumn IS NULL
  1. Alter the table to change the property of the column
ALTER TABLE MyTable
ALTER COLUMN MyNullableColumn MyNullableColumnDatatype NOT NULL

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

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
  1. Alter the table to change the property of the column
ALTER TABLE MyTable
ALTER COLUMN MyNullableColumn MyNullableColumnDatatype NOT NULL
added 3 characters in body
Source Link
Matas Vaitkevicius
  • 61.8k
  • 37
  • 252
  • 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 NULLUPDATE 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 NULLALTER TABLE MyTable ALTER COLUMN MyNullableColumn MyNullableColumnDatatype NOT NULL

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

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

added 24 characters in body
Source Link
I A Khan
  • 8.9k
  • 16
  • 56
  • 78

You will have to do it in two steps:

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

    UPDATE MyTable SET MyNullableColumn = 0 WHERE MyNullableColumn IS NULL

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

    ALTER TABLE MyTable ALTER COLUMN MyNullableColumn MyNullableColumnDatatype NOT NULL

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

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

Source Link
Ralph Wiggum
  • 699
  • 1
  • 6
  • 10
Loading