[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: [sqr-users] brain dead?
The workaround is correct. You must compare dates in YYYYMMDD or
Julian format.
To further explain, SQR does not recognize dates at all. Dates
function properly within begin-sql/end-sql pairs and in where clauses
because they are being parsed by the database server, not by SQR.
But in SQR, the variable storing the date is a character variable, so
it is evaluated under character rules. Therefore 01-JAN-2004 is less
than 08-NOV-2003 because character variables are compared left to
right. So once the comparison hits the 08 and 01, since 08 is greater
than 01, that is the end of the comparison.
On Wed, 23 Jun 2004 09:14:05 -0400, you wrote:
>As I recall, this is an old "feature" of SQR regarding the late day of the
>month. There should be many archived postings.
>
>Basically, when you compare dates in SQR the last day of one month is NOT less
>than the first of the next month - how's that for logic. This is NOT a problem
>when the date coparisons are part of your SQL Select Statement.
>
>The workaround is to convert dates to YYYYMMDD strings or numbers and then
>compare the strings/numbers.
>
>
>
>-----Original Message-----
>From: sqr-users-bounces+jbeller=lbisoftware.com@sqrug.org
>[mailto:sqr-users-bounces+jbeller=lbisoftware.com@sqrug.org]On Behalf Of
>Timm Buchanan
>Sent: Tuesday, June 22, 2004 6:05 PM
>To: sqr-users@sqrug.org
>Subject: [sqr-users] brain dead?
>
>
>OK, so spent the weekend in NYC for a Bachelor Party and probably
>killed a few brain cells, but this is getting a little crazy. Please
>help me prove my sanity....
>
>
>begin-procedure report
>
>let $date1 = '08-NOV-2003'
>let $date2 = '08-JAN-2004'
>let $fromdate = '01-JAN-2004'
>let $thrudate = '31-JAN-2004'
>
>end-procedure
>
>
>
>In my mind:
>
>$date1 is < $fromdate
>$date2 is > $fromdate
>$date2 is < $thrudate
>
>However, running this procedure with some tests show this:
>
>$date1 08-NOV-2003
>$date2 08-JAN-2004
>$fromdate 01-JAN-2004
>$thrudate 31-JAN-2004
>date 1 >= fromdate
>date 2 >= fromdate
>date 1 <= thrudate
>date 2 <= thrudate
>
>What am I missing? I have been writing SQR code for many years now...I
>think I killed the SQR brain cells this weekend.....
>
>Thanks...
>
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users