Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    45

    Unanswered: 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.

  2. #2
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    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.

  3. #3
    Join Date
    Jul 2004
    Posts
    45
    I didn't realize that. Thanks for the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •