SET NULL Command

Example   See Also

Determines how null values are supported by the ALTER TABLE, CREATE TABLE and INSERT - SQL commands.

Syntax

SET NULL ON | OFF

Arguments

ON

Specifies that all columns in a table created with ALTER TABLE and CREATE TABLE will allow null values. You can override null value support for columns in the table by including the NOT NULL clause in the columns' definitions.

Also, specifies that INSERT - SQL will insert null values into any columns not included in the INSERT - SQL VALUE clause. INSERT - SQL will insert null values only into columns that allow null values.

Note   If you add support for null values to one or more columns in a table, the limit on the number of columns for that table is reduced from 255 to 254.

OFF

(Default) Specifies that all columns in a table created with ALTER TABLE and CREATE TABLE will not allow null values. You can designate null value support for columns in ALTER TABLE and CREATE TABLE by including the NULL clause in the columns' definitions.

Also specifies that INSERT - SQL will insert blank values into any columns not included in the INSERT - SQL VALUE clause.

Remarks

SET NULL affects only how null values are supported by ALTER TABLE, CREATE TABLE and INSERT - SQL. Other commands are unaffected by SET NULL. SET NULL is scoped to the current data session.