IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Default date of a Column in DB2 table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vab987

New User


Joined: 01 Dec 2006
Posts: 29
Location: S.A

PostPosted: Mon May 07, 2007 3:42 pm
Reply with quote

Hi all,

What is the default date of a Column in DB2 table . Is it 1900-01-01 ??

Thanks,
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Mon May 07, 2007 4:08 pm
Reply with quote

Hi vab987,

What does "default date of a Column" mean?
Back to top
View user's profile Send private message
skkp2006

New User


Joined: 14 Jul 2006
Posts: 93
Location: Chennai,India

PostPosted: Mon May 07, 2007 4:37 pm
Reply with quote

Default date is the one which we have to specify at the time of table definition.I think if we give the date field with default it will populate "01-01-0001" otherwise it will take the current date when we insert data into the table and no value is passed to the host variables.

But i have seen that normally the default value is moved to the host variable in the program rather than while creating the table.I am also looking forward for the reason for that :-(

Regards,
Syam
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Mon May 07, 2007 6:43 pm
Reply with quote

Hi !

When you define a table-field which should contain a date you can specify a default.

ZZZ_ADTM DATE NOT NULL WITH DEFAULT '0001-01-01'

@skkp2006:

When you insert values into table-fields there is no automation. You have to provide the host-variable with a correct date-value for such fields. Otherwise you would get SQl-Error.

Regards, UmeySan
Back to top
View user's profile Send private message
vab987

New User


Joined: 01 Dec 2006
Posts: 29
Location: S.A

PostPosted: Wed May 09, 2007 4:14 pm
Reply with quote

Thanks everyone .
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts count contained values of several col... DB2 5
No new posts Sorting date into YYYYMMDD, and creat... DFSORT/ICETOOL 13
No new posts To join 2 tables and to join 3rd tabl... DB2 8
No new posts Sort card to know that creation date ... DFSORT/ICETOOL 10
No new posts Create a specific record/file based o... SYNCSORT 8
Search our Forums:


Back to Top