Assume a table with date data stored as numbers defined as 8,0.
In a 6.1 or newer box, you can use "timestamp_format" to convert these numbers into dates, if they are valid dates.
Running this SQL will convert those numbers that can be translated into dates and fail to convert the others.
So you could use this to test the numbers entered as representing dates or to identify those numbers that are not correct representations of dates.
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Hoteltravelfundotcom
Sent: Tuesday, May 06, 2014 10:26 AM
To: Midrange Systems Technical Discussion
Subject: can this reject bad data?
There is some bad data in our system. there is a lack of
validate checking. in this case, can this sql reject for processing
any such bad dates? bad dates are defined as month > 12 and days accordinlgy
SUBSTR(DIGITS(UAFLWD),5,2) CONCAT '/' CONCAT
,7,2) CONCAT '/' CONCAT SUBSTR(DIGITS(UAFLWD),3,2) AS FOLLOWUP,
(T01.UAENT#), T01.UASFX#, T02.ADENTN, T01.UANOTT, T01.UANOTL, T02.ADLNM, T02.ADFNM,
FROM ASTDTA.NOTEHDUA T01 INNER JOIN
ON UAENT# = ADENT#
AND UASFX# = ADSFX#
WHERE UAFLWD BETWEEN 20000101 AND 20991231
AND UAPRGD < 1
AND UANOTT = 'E'
ORDER BY 001 ASC, 008 ASC
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l
This communication, including attachments, is confidential, may be subject to legal privileges, and is intended for the sole use of the addressee. Any use, duplication, disclosure or dissemination of this communication, other than by the addressee, is prohibited. If you have received this communication in error, please notify the sender immediately and delete or destroy this communication and all copies.