Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002
    Location
    Chile
    Posts
    1

    Unanswered: Using Column Aliases

    I'm a bit of a n00b to DB2.

    I'm trying to execute a SQL command on a DB2 database, using RUMBA ODBC driver and ADO. The problem is that column aliases don't seem to work.

    This works:
    SELECT MANDT FROM ZVTAMES2

    This doesn't:
    SELECT MANDT AS SomeName FROM ZVTAMES2

    Nor does:
    SELECT MANDT SomeName FROM ZVTAMES2

    (queries simplified, obv)

    The error I get is:
    Syntax error or access violation. SQLSTATE=42601H: Invalid character in an SQL statement. SQLCODE = -104 : Token 'SomeName' was not valid. Valid tokens: <IDENTIFIER>

    Can anyone tell me what I'm doing wrong?

    Thanks,

    Jim

  2. #2
    Join Date
    Dec 2002
    Posts
    1

    Re: Using Column Aliases

    Originally posted by JimFraser
    I'm a bit of a n00b to DB2.

    I'm trying to execute a SQL command on a DB2 database, using RUMBA ODBC driver and ADO. The problem is that column aliases don't seem to work.

    This works:
    SELECT MANDT FROM ZVTAMES2

    This doesn't:
    SELECT MANDT AS SomeName FROM ZVTAMES2

    Nor does:
    SELECT MANDT SomeName FROM ZVTAMES2

    (queries simplified, obv)

    The error I get is:
    Syntax error or access violation. SQLSTATE=42601H: Invalid character in an SQL statement. SQLCODE = -104 : Token 'SomeName' was not valid. Valid tokens: <IDENTIFIER>

    Can anyone tell me what I'm doing wrong?

    Thanks,

    Jim
    Try this
    Select Colname "alias" from your table

Posting Permissions

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