View previous topic :: View next topic
|
Author |
Message |
royalchm
New User
Joined: 15 Nov 2007 Posts: 29 Location: Bangalore
|
|
|
|
if we specified "NOT NULL with Default" it will take default values in the field if the field is null
my questions are
1) can we set any default value instead of '0' for numeric and 'NULL' for alpha?
2) if we use NOT NULL with Default, then 0 is a valid data in the same filed the how we can differentiate.
eg: Empid is created with NOT NULL WITH DEFAULT option and field is a numeric field then for empid '0' is valid empid, then how we can find out the null values through querry? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Quote: |
then how we can find out the null values through query? |
review the application design
if a column is NOT NULL, it will never have a ... NULL VALUE
NULL ==> without an assigned value |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you need to review (learn?) the meaning of NULL within DB2 context:
null. A special value that indicates the absence of information or data.
nul or the null character x'00', or low-values (cobol)
a numeric zero is a valid numeric character.
very little of your post was accurate.
NOT NULL with Default is a column attribute which says if during an INSERT, no value is provided, the Default will be inserted by DB2.
INSERT syntax for NULL would be two ,, denoting no value - or NULL - as the insert value for the column.
there is syntax for determining if a column is NULL - check out the vsn 8 application programmers guide and the vsn 8 sql reference.
if you using a different version then the DB2 Library will point you to the version you are interested in. |
|
Back to top |
|
|
|