Unbinding defaults  After creating a default

Chapter 13: Defining Defaults and Rules for Data

How defaults affect NULL values

If you specify NOT NULL when you create a column and do not create a default for it, Adaptive Server produces an error message whenever anyone inserts a row and fails to make an entry in that column.

When you drop a default for a NULL column, Adaptive Server inserts NULL in that position each time you add rows without entering any value for that column. When you drop a default for a NOT NULL column, you get an error message when rows are added, without a value entered for that column.

Table 13-1 illustrates the relationship between the existence of a default and the definition of a column as NULL or NOT NULL.

Table 13-1: Column definition and null defaults

Column definition

User entry

Result

Null and default defined

No value

NULL value

Default used

NULL used

Null defined, no default defined

No value

NULL value

NULL used

NULL used

Not null, default defined

No value

NULL value

Default used

Error

Not null, no default defined

No value

NULL value

Error

Error





Copyright © 2005. Sybase Inc. All rights reserved. After creating a default

View this book as PDF