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 : ERROR [42000] [QODBC] Expected lexical element not found: <identifier>Search Forum

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

 New Topic 
 
 Post Reply 
[1]  
 ERROR [42000] [QODBC] Expected lexical element not found: <identifier> 
 Author   Message 
  Andrew Baldwin 
  
 Group: Members 
 Posts: 3 
 Joined: 2006-05-16 
 Profile
 Posted : 2006-08-11 01:23:40
I have constructed an insert statement that is getting this error, in order to narrow it down, I modified the values
portion of my query to be a select instead, and tested the different data t ypes that I was trying to select.

After doing so, I was able to determine that the problem is with both the ts and d functions that we have here, and I had to assume that it was the inputs fault and not yours since the function is referenced everywhere. I seemed to remember reading somewhere that you guys do use the computers regional time settings to figure out how to parse out times, but after my test, I found this not to be the case.

For example

select {ts'8/20/2006 9:26:15 AM'} from customer
and
select {d'9/15/2006'} from customer
both give the lexical element error.

My "Regional and Language settings" in "Control Panel" say my date time format looks like so:

Time :             10:04:29 AM
Short Date :    8/10/2006
Long Date:     Thursday, August 10, 2006

Which I was hoping that you guys wer paying attention to, after all, thats what .Net does and it seems to work great.

So after realizing this, I tested the following and got the expected result and no error: (The resulting value/column that it displays shows the time in my local regional settings which makes it that much more annoying...)

select {d'2006-06-26'} from customer

This results in "6/26/2006 12:00:00 AM" which is expected, but having to format the time for the select/insert/update/delete statement, just so it can be formatted back seems like a lot of overhead...

For those of us using .Net (or any language that supports date/time formatting via a format string), you should be able to use the following:

string date= System.DateTime.Now.ToString("yyyy-MM-dd");
string datetime= System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt");

which will give  you:

2006-08-10
and
2006-08-10 10:10:39 AM

respectivly, which can be used in your SQL Statement afterwards...

This could be a huge pain in other programming languages, I am lucky that .Net has it so that I can change the date format with one line, other languages may require a load of parsing...

Anywho, if you have a function to read the time, then you should parse it according to the machines regional settings, but thats just my opinion....

Hopefully this post will help someone that was stuck on this for a few hours  like I was...

AB 

 
~~ Insert clever signature here ~~

** This space for rent ** 
 
  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-08-11 10:22:21

QODBC uses the standard SQL Date {d'YYYY-MM-DD'} and Timestamp  {ts 'YYYY-MM-DD HH:mm:SS.zzz'} formats and is the same worldwide regardless of the region:

See also: How are dates formatted in SQL queries when using the QuickBooks generated time stamps? 

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to