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 > Char field In SQL Statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-28-04, 17:42
probelaw probelaw is offline
Registered User
 
Join Date: Jul 2004
Posts: 44
Char field In SQL Statement

I am trying to get data from 2 different tables using the statement here:

SELECT EVENT.EventCode, EVENT.CompletedDate, EVENT.CompletedTime, EVENT.NeededTime, EVENT.Comments, EVENT.NeededDate, EVDEF.Desc
FROM EVENT, EVDEF
WHERE EVENT.EventCode = EVDEF.Code AND OrderNumber = 'varOrderNumber'
ORDER BY Sequence

(Event.EventCode and EVDEF.Code being the keys.)

The problem is when I run the query, I get a syntax error every time with <<???>> after the EVDEF.Desc field (see below). In looking at the data in that field, there are trailing space placeholders, so I assume it is a char field.

If I delimit it with 'EVDEF.Desc' in the statement it runs the query, but I get the value "EVDEF.Desc" for that value on every record.


Is there a different way to delimit a char field? What am I doing wrong?

SQL Error Message:

[Pervasive][ODBC Client Interface][Pervasive][ODBC Engine Interface]Syntax Error: SELECT EVENT.EventCode, EVENT.CompletedDate, EVENT.CompletedTime, EVENT.NeededTime, EVENT.Comments, EVENT.NeededDate, EVDEF.Desc<< ??? >> FROM EVENT, EVDEF WHERE EVENT.EventCode = EVDEF.Code AND OrderNumbe

(Note: The << ??? >> appears after the EVDEF.Desc declaration no matter where it is in the statement.
Reply With Quote
  #2 (permalink)  
Old 09-28-04, 23:34
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
DESC is a reserve word. Use the following:
SELECT EVENT.EventCode, EVENT.CompletedDate, EVENT.CompletedTime, EVENT.NeededTime, EVENT.Comments, EVENT.NeededDate, EVDEF."Desc"
FROM EVENT, EVDEF
WHERE EVENT.EventCode = EVDEF.Code AND OrderNumber = 'varOrderNumber'
ORDER BY Sequence
__________________
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 09-29-04, 12:24
probelaw probelaw is offline
Registered User
 
Join Date: Jul 2004
Posts: 44
I didn't realize that. Thanks for the help!
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