Professional Web Applications Themes

how to execute the query with special character - IBM DB2

hello, i am using command window on db2 udb v8.1 on windows to query a table with field name like this select abc\ from table, but i get the error \ is invalid, so how to let the db2 accept it? thanks...

  1. #1

    Default how to execute the query with special character

    hello, i am using command window on db2 udb v8.1 on windows to query a
    table with field name like this select abc\ from table, but i get the
    error \ is invalid, so how to let the db2 accept it? thanks
    xixi Guest

  2. #2

    Default Re: how to execute the query with special character

    Try putting your command in quotes:
    db2 "select abc\ from table....."
    On the other hand, are you trying to get a
    "select col1 from table where col1='abc\'"
    Is your col really called abc\ ???
    HTH, Pierre.
    PS: I think it treats the \ as an escape char.

    xixi wrote:
    > hello, i am using command window on db2 udb v8.1 on windows to query a
    > table with field name like this select abc\ from table, but i get the
    > error \ is invalid, so how to let the db2 accept it? thanks
    P. Saint-Jacques Guest

  3. #3

    Default Re: how to execute the query with special character

    xixi wrote:
    > hello, i am using command window on db2 udb v8.1 on windows to query a
    > table with field name like this select abc\ from table, but i get the
    > error \ is invalid, so how to let the db2 accept it? thanks
    You need to enclose your column names with quotes:

    C:\>db2 -tvf test.sql
    create table t1 ( "abc\" int, "cde" char(5) )
    DB20000I The SQL command completed successfully.

    insert into t1 values (1,'Row 1'), (2, 'Row 2')
    DB20000I The SQL command completed successfully.

    select "abc\" from t1

    abc\
    -----------
    1
    2

    2 record(s) selected.


    select * from t1 where "abc\" = 1

    abc\ cde
    ----------- -----
    1 Row 1

    1 record(s) selected.



    Good luck,





    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    [url]http://www.newsfeeds.com[/url] - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
    Ian Guest

  4. #4

    Default Re: how to execute the query with special character

    This post is being sent with unicode encoding UTF-8 setting in my news
    reader program.
    You should be able to see chars a i see them.

    This is not an answer, just a few possibly useful infos...


    What are your windows regional settings? (what and how many languages are
    installed?)

    What code pages are installed on windows?

    Is your source code saved in unicode? (wordpad, save as unicode, ...)

    When you do CHCP on a windows command promp (cmd.exe), what does it say?
    (chcp=change code page)

    What are the db cscp settings? (Get DB Cfg)
    Database territory
    Database code page
    Database code set
    Database country/region code


    Depending on what settings you use, you may see different chars.
    >type source.txt
    032-039 !"#$%&'
    040-049 ()*+,-./012
    130-139
    >chcp
    Page de codes active : 850
    >chcp 1250
    Page de codes active: 1250
    >type source.txt
    032-039 !"#$%&'
    040-049 ()*+,-./012
    130-139 ???aa?e?ei
    >chcp 863
    Page de codes active : 863
    >type unicode-source.txt
    032-039 !"#$%&'
    040-049 ()*+,-./012
    130-139 aa



    Here, it begins with cscp 1252

    I:\DB2USR\TEST>DB2 CREATE TABLE "DBOXA"."TT" (COL1 INT)
    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL0007N The character "" following "REATE TABLE DBOXA.TT" is not valid.
    SQLSTATE=42601

    I:\DB2USR\TEST>CHCP 850
    Page de codes active : 850

    I:\DB2USR\TEST>DB2 CREATE TABLE "DBOXA"."TT" (COL1 INT)
    DB20000I The SQL command completed successfully.


    Save your source code as unicode.
    s2.executeUpdate ("insert into DBOXA.TT (COL1) values (5)");

    When you edit, switch to the right locale.
    I do it using the alt-shift key combination because i have set it this way
    in the regional settings.

    You should also refer to the doc section called
    Reference - SQL - Language Elements
    Base url : [url]http://publib.boulder.ibm.com/infocenter/db2help/index.jsp[/url]


    PM


    "xixi" <dai_xi> a crit dans le message de
    news:c0f33a17.0309151458.3c137a9eposting.google.c om...
    > hello, i am using command window on db2 udb v8.1 on windows to query a
    > table with field name like this select abc\ from table, but i get the
    > error \ is invalid, so how to let the db2 accept it? thanks

    PM \(pm3iinc-nospam\) Guest

  5. #5

    Default Re: how to execute the query with special character

    actually my big problem is the fieldname with currency symbol . For
    example select abc from table.


    Database territory = JP
    Database code page = 1208
    Database code set = UTF-8
    Database country/region code = 81

    If the pc set up English locale, i have no problem to execute the
    query through db2jcc.jar. But if the pc is setup Japan local, there is
    always error.
    xixi Guest

  6. #6

    Default Re: how to execute the query with special character

    Call service to open an PMR. JDK supports many Japanese conversion methods.
    Some of them is syntax base and some of them is glyph base. Syntax base
    conversion map yen to backslash in unicode. Glyph base conversion map yen
    to yen in Unicode. Please note that yen and backslash are two different
    characters. Currently JCC is using a glyph base conversion in JDK.

    Sherman
    "xixi" <dai_xi> wrote in message
    news:c0f33a17.0309161505.270b2136posting.google.c om...
    > actually my big problem is the fieldname with currency symbol . For
    > example select abc from table.
    >
    >
    > Database territory = JP
    > Database code page = 1208
    > Database code set = UTF-8
    > Database country/region code = 81
    >
    > If the pc set up English locale, i have no problem to execute the
    > query through db2jcc.jar. But if the pc is setup Japan local, there is
    > always error.

    Sherman Lau Guest

Similar Threads

  1. MX 7 and CGI special character problem
    By Keimo in forum Coldfusion - Getting Started
    Replies: 1
    Last Post: July 25th, 03:11 PM
  2. Replies: 0
    Last Post: September 15th, 04:33 PM
  3. Special Character search lik
    By preetinder dhaliwal in forum Informix
    Replies: 1
    Last Post: August 27th, 04:17 AM
  4. Special character for SM?
    By designer in forum Macromedia Dreamweaver
    Replies: 3
    Last Post: July 28th, 02:14 PM
  5. I need a special character....
    By E. T. Culling in forum Macromedia Fireworks
    Replies: 5
    Last Post: July 28th, 11:46 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139