× 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.



There is a keyword that can be placed in the DDS that may solve your problem.

A MYDATE l B 4 7DATFMT(*ISO)
A MAPVAL(('0001-01-01 *BLANK))



Bill Milyard
AS400 Programmer
3776 South High Street
Columbus, OH 43207
Phone: 614/497-4712
FAX: 614/409-2016
www.bobevans.com


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Booth Martin
Sent: Wednesday, September 11, 2013 3:07 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: insert a null into a date/time field on SQL Server

*loval is your friend.

On 9/11/2013 2:06 PM, Smith, Mike wrote:
I've always populated a date/time field with a "DEFAULT" date when I don't have a date value to populate.

However, I would like to get away from this if possible.

This is what I'm doing currently

test(de) *ISO SFDATE;

if not %error ;
SurveyDate = %date(SFDATE : *ISO);
Else ;
SurveyDate = defaultdate ;
EndIf;

stmt = JDBC_PrepStmt(conn : 'Insert Into ELECTRICSURVEY'
+ '(OBJECTID,'
+ ' SERVICENUMBER,'
+ ' SURVEYDATE,'
+ ' CREATIONUSER,'
+ ' VOLTAGE,'
+ ' COMMENTS)'
+ ' values (?,?,?,?,?,?)');

JDBC_setInt (stmt: 1: ID);
JDBC_setString (stmt: 2: SFEID);

JDBC_setDate (stmt: 3: SurveyDate);

JDBC_setString (stmt: 4: INSPECT);
JDBC_setDecimal (stmt: 5: VGREAD);
JDBC_setString (stmt: 6: DESCRIPT);
rc = JDBC_ExecPrepUpd( stmt );


SO if SFDATE is 0 in my file, can I set SURVEYDATE to null and if so how?

I've played around with this, but haven't had any success.

Thanks

Mike
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.

--
Booth Martin
www.martinvt.com
(802)461-5349
Skype: booth.martin

Mitchell's Law of Committees: Any simple problem can be made insoluble
if enough meetings are held to discuss it.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

________________________________

Notice from Bob Evans Farms: This e-mail message, including any attachments, may contain confidential information that is intended only for the person or entity to which it is addressed. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and any attachments.

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.