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 and String Where clauses using SQL Server 2005Search Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC v8 Forum

 New Topic 
 
 Post Reply 
[1]  
 Date and String Where clauses using SQL Server 2005 
 Author   Message 
  Ken Brey 
  
 Group: Members 
 Posts: 9 
 Joined: 2008-02-09 
 Profile
 Posted : 2008-02-09 07:26:18
What syntax to I use for date or string entry in Where clauses when doing queries through the SQL Server linkes server interface?  The following query doesn't work:

SELECT * FROM OPENQUERY(QODBC,'
SELECT * FROM TimeTracking
Where TxnDate>=#11/18/2007# And TxnDate<=#11/25/2007#
');

The error message is:
OLE DB provider "MSDASQL" for linked server "QODBC" returned message "[QODBC] Unexpected extra token: #".

Similarly, I can't use string constants in the Where clause either because the whole thing is contained in single quotes. 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-02-10 22:18:11

Ok, the trick is to insert any single qoutes in singles quotes (yes, two single quotes) like this:

SELECT * FROM OPENQUERY(QODBC,'
SELECT * FROM TimeTracking
Where TxnDate>={d''2007-11-18''} And TxnDate<={d''2007-11-25''}');

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 
 New Topic 
 
 Post Reply 
[1]  

Jump to