When you specify values for only some of the columns in a row, one of these things happen to the columns with no values:
If a default value exists for the column or user-defined datatype of the column, it is entered. See Chapter 14, “Defining Defaults and Rules for Data,” or insert in the Reference Manual: Commands.
If NULL was specified for the column when the table was created and no default value exists for the column or datatype, NULL is entered. See insert in the Reference Manual: Commands.
If the column has the IDENTITY property, a unique, sequential value is entered.
If NULL was not specified for the column when the table was created and no default exists, Adaptive Server rejects the row and displays an error message.
Table 7-4 shows what you would see under these circumstances:
Default exists for column or datatype |
Column defined NOT NULL |
Column defined to allow NULL |
Column is IDENTITY |
---|---|---|---|
Yes |
The default |
The default |
Next sequential value |
No |
Error message |
NULL |
Next sequential value |
Use sp_help to display a report on a specified table or default, or on any other object listed in the system table sysobjects. To see the definition of a default, use sp_helptext.