× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



1/1/1 is not a default SQL date. It's probably being set into the field in the program.

If you leave the PHDATE and PHTIME out of the list of fields in the insert, then they get the default. If you specify the fields and want to override the values, you can specify DEFAULT in the list of values for the fields instead of a host variable.

Doug Palme wrote:
Here is what I added to the DDL:

0002.00 PHDATE DATE WITH DEFAULT CURRENT DATE, 0003.00 PHTIME TIME WITH DEFAULT CURRENT TIME, ....

When using DBU it works perfectly....however, when a program writes a record those fields end up with a default date of 00001-01-01 and a default time of 00.00.00......obviously I am doing something wrong.....





From:
R Bruce Hoffman <bruce.hoffman@xxxxxxxxxxxxxxxxx>
To:
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
Date:
05/22/2008 10:07 AM
Subject:
Re: Question on SQL Table (DDL) with date and time fields



create table ... ( .... date with default current date ... )

Only defaults on insert when the field is not specified in the insert list. Updates leave it unaffected.

Doug Palme wrote:
is there a way to auto populate a date / time field with the current
date
and time without actually having code to do it? IE: Is there a default setting within the DDL spec that would cause the date field to be
filled?
Although as I think about this, that might be a problem on subsequent updates......


This transmission may contain information that is privileged,
confidential
and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure,
copying,
distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy

the material in its entirety, whether in electronic or hard copy format.

Thank you.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.