Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2002
    Posts
    16

    Unanswered: Column Name with Double Quotes

    I exported a table from MS Access to DB2. Some column names have double quotes in DB2 (e.g. "col1", "col2", col3).

    When query the table from CLP or using db2 scripts, it looks like that DB2 does not accept column name with quotes.

    I tried the following and all failed with the same message that column name was not found.
    (1) select "col1", "col2" from tbl_temp
    (2) select 'col1', 'col2' from tbl_temp
    (3) select \"col1\", \"col2\" from tbl_temp

    Any clue? Does db2 support the column name with double quotes? Thanks!

  2. #2
    Join Date
    Jan 2003
    Location
    Schaumburg, IL
    Posts
    79
    Hey,

    What was the procedure used to export the table from Access to DB2?


    Cheers,
    Naveen.

  3. #3
    Join Date
    Sep 2002
    Posts
    456

    Re: Column Name with Double Quotes

    try your select statment without single or double quotes:

    select col1, col2 from tbl_temp;

    it's acceptable to create table by providing double quotes around the column names and/or table name but database stores the names without any quote.

    dollar

    Originally posted by alex_db
    I exported a table from MS Access to DB2. Some column names have double quotes in DB2 (e.g. "col1", "col2", col3).

    When query the table from CLP or using db2 scripts, it looks like that DB2 does not accept column name with quotes.

    I tried the following and all failed with the same message that column name was not found.
    (1) select "col1", "col2" from tbl_temp
    (2) select 'col1', 'col2' from tbl_temp
    (3) select \"col1\", \"col2\" from tbl_temp

    Any clue? Does db2 support the column name with double quotes? Thanks!

  4. #4
    Join Date
    Oct 2002
    Posts
    16
    Thanks for the reply.

    I export the table from Access to DB2 using ODBC driver.

    I also tried select col1, col2 from tbl_temp and it does not work either.

  5. #5
    Join Date
    Dec 2002
    Posts
    134
    Perform describe table (or select from syscat.columns) and you will see the correct columns names.
    Basically if you get column name uppercased, most likely you can omit double quotes, otherwise you must have them

    The command

    describe table blah

    regards,
    dmitri

Posting Permissions

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