If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Pervasive.SQL > Sql Problem With Dates

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-06-07, 08:09
Derick Salls Derick Salls is offline
Registered User
 
Join Date: Feb 2007
Posts: 6
Sql Problem With Dates

Using VB6, I am opening a Pervasive table using ADO and a SQL query of the form "Select * from arlinh WHERE shipdate > '12/2/2006'". If I use any field other than a date field, I have no problems. However, with a date field, I get an error....
[LBA][Pervasive][ODBC Engine Interface]Error in Predicate:shipdate > '12/2/2006'
Why am I having problems with dates.
Reply With Quote
  #2 (permalink)  
Old 02-06-07, 14:07
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
If the field in the Pervasive table is defined as a "Date", then you'll need to specify the date in the format: 'yyyy-mm-dd'. You will need to include it in single quotes. So your statement would be:
Code:
Select * from arlinh WHERE shipdate > '2006-12-02'
__________________
Mirtheil Software
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
Reply With Quote
  #3 (permalink)  
Old 02-07-07, 06:21
Derick Salls Derick Salls is offline
Registered User
 
Join Date: Feb 2007
Posts: 6
It worked beautifully

Thanks! I tried a similar format, but yours was the one that worked. I eventually wound up with a WHERE phrase that read....
"WHERE ((shipdate BETWEEN '12/3/2006' AND '1/6/2006') AND (revenueacctkey BETWEEN '4000000' AND '4999Z999'))"
Thanks again.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On