Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Querying for dates

1 view
Skip to first unread message

S B Gogia

unread,
Jul 12, 2009, 10:31:03 PM7/12/09
to
Hi All,
PB 9.03, SQL Anwhere 8

When I do a filter in the Datawindow preview mode or in the database
directly using

first_visit BETWEEN '2007-06-30' AND '2009-07-01'

it works OK (Frst_visit is the column name, we are using British date
formats (dd/mm/yy)

but the same if done in Query mode at runtime generates an error ("Cannot
covert '2009-' to a timestamp". Changing the format to any other or even
adding the Function Date ie
BETWEEN Date('30/06/2007') AND date('01/07/2009')
results in a simlar error (cannot convert '01/07/200' to a Timestamp

In both if we notice the complete string is missing

Of course use of >'30/06/07' In one row and <'01/07/09' in the next
retrieves all the rows as the interlinking critieria is taken as OR for the
two rows

What may I be doing wrong??

TIA


Chris Pollach

unread,
Jul 13, 2009, 7:22:34 AM7/13/09
to
Hi SB;

You must use the ANSI standard yyyy-mm-dd.
That is how all dates in DBMS are stored internally.

--
Regards ... Chris
ISUG - NA RUG Director
http://chrispollach.pbdjmagazine.com


"S B Gogia" <gog...@gmail.com> wrote in message
news:4a5a9c67$2...@forums-3-dub.sybase.com...

S B Gogia

unread,
Jul 16, 2009, 12:10:03 PM7/16/09
to
Well thats exactly what I did ( mentioned in the first para- only removed
the columna name becuse that is implicit while in query mode so the syntax
used was
"BETWEEN '2007-06-30' AND '2009-07-01' "
Got en error message "Cannot convert '2009-' to a timestamp".

regards

"Chris Pollach" <cpol...@travel-net.com> wrote in message
news:4a5b18fa$1...@forums-3-dub.sybase.com...

Chris Pollach

unread,
Jul 16, 2009, 12:45:10 PM7/16/09
to

Ahhhh ... if this is not a DATE type of column but a DateTime data type you
would have to change it to the ANSI standard for that data type ...

BETWEEN '2007-06-30 00:00:00' AND '2009-07-01 23:59:59'

See if that helps your aligning DML processor! :-)

"S B Gogia" <gog...@gmail.com> wrote in message

news:4a5f50db$1...@forums-3-dub.sybase.com...

0 new messages