Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

NOT NULL with Default

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
royalchm

New User


Joined: 15 Nov 2007
Posts: 29
Location: Bangalore

PostPosted: Tue Dec 01, 2009 3:45 pm    Post subject: NOT NULL with Default
Reply with quote

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
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Tue Dec 01, 2009 3:51 pm    Post subject: Reply to: NOT NULL with Default
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Tue Dec 01, 2009 3:59 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us