Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Date Comparison in SELECT StmtSearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC SQL Support Forum

 New Topic 
 
 Post Reply 
[1]  
 Date Comparison in SELECT Stmt 
 Author   Message 
  Tom 
  
 Group: Members 
 Posts: 5 
 Joined: 2008-01-11 
 Profile
 Posted : 2008-02-07 00:58:10

I'm having problems when I attempt to include a Date comparison in the where clause of my SELECT statement The error I'm getting is:  ERROR [42000] [QODBC] Expected lexical element not found: <identifier>   and my SQL Statement is as follows: 

"Select AccountNumber as PropertyID, AltContact as PropertyAddress, CustomerTypeRefFullName as Type, Fax as Code, Contact as Owner, Phone as Phone1, AltPhone as Phone2, BillAddressAddr1 + ' ' + BillAddressAddr2 as MailingAddress,TermsRefFullName as Status, ResaleNumber From Customer where TimeModified > {d'9/30/2007'} ORDER By AccountNumber"

If I remove the {d' syntax from the date comparision yielding the following SQL:

"Select AccountNumber as PropertyID, AltContact as PropertyAddress, CustomerTypeRefFullName as Type, Fax as Code, Contact as Owner, Phone as Phone1, AltPhone as Phone2, BillAddressAddr1 + ' ' + BillAddressAddr2 as MailingAddress,TermsRefFullName as Status, ResaleNumber From Customer where TimeModified > '9/30/2007' ORDER By AccountNumber"  

If then receive this error

ERROR [42S00] [QODBC] Invalid operand for operator: >

Can you please provide some instruction on using date comparisons in the WHERE clause for a SELECT statement? 

 

Thanks,

Tom A

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-02-07 08:16:07

The correct statement is:

Select AccountNumber as PropertyID, AltContact as PropertyAddress,
CustomerTypeRefFullName as Type, Fax as Code, Contact as Owner,
Phone as Phone1, AltPhone as Phone2, BillAddressAddr1 + ' '
+ BillAddressAddr2 as MailingAddress,TermsRefFullName as Status,
ResaleNumber From Customer where TimeModified > {ts '2007-09-30 00:00:00.000'}
ORDER By AccountNumber

See: How are dates formatted in SQL queries when using the QuickBooks generated time stamps?  and What Time and Date Functions can be used with QODBC? for further information.

 

  Top 
  Tom 
  
 Group: Members 
 Posts: 5 
 Joined: 2008-01-11 
 Profile
 Posted : 2008-02-10 00:02:35

Tom

Thank you for your response....

Tom A.

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to