Results 1 to 12 of 12
  1. #1
    Join Date
    Oct 2007
    Posts
    13

    Unanswered: SQL0104 - Token * not valid

    Hello I am trying to extract data from DB2 using this query

    SELECT T2.CIADNH, T2.DPTDNH, T2.FICDNH, T1.APEFI1, T1.NOMFI1, T2.CTODNH, T3.DESCTO, T2.CANDNH, T2.MONDNH, T2.PRDDNH, T2.AÑODNH
    FROM SPIDATA.NMPP060 T1, SPIDATA.NMPP099 T2, SPIDATA.NMPP027 T3
    WHERE (T2.CTODNH In (011.071.072))

    but I get the following msg

    SQL0104 - Token .072 was not valid. Valid tokens: ,.

    If I take out the .072 from the query it does work

    Can anyone please help me?
    Thanks in advanced.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    What data type is T2.CTODNH?

    If it is numeric, then 011.071.072 is nat a valid numeric expression.
    If it is character the it is not a valid character expression.


    Andy

  3. #3
    Join Date
    Oct 2007
    Posts
    13
    Quote Originally Posted by ARWinner
    What data type is T2.CTODNH?

    If it is numeric, then 011.071.072 is nat a valid numeric expression.
    If it is character the it is not a valid character expression.


    Andy
    Hello ARWinner in both cases what should be the correct format?
    I did a query for T2.CTODNH and result data was
    10
    96
    103

    I think it is numeric
    Thank you

  4. #4
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    run
    describe table SPIDATA.NMPP099

    and post it here
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  5. #5
    Join Date
    Oct 2007
    Posts
    13
    Quote Originally Posted by Cougar8000
    run
    describe table SPIDATA.NMPP099

    and post it here
    Cougar8000 unfortunately I am the in control of that information I only have access to extract data from the DB2 server

    What other choice do I have?
    Thank you.

  6. #6
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Well assuming it is numeric, then the list would look like this:

    (T2.CTODNH In (11,71,72))

    Andy

  7. #7
    Join Date
    Oct 2007
    Posts
    13
    Quote Originally Posted by ARWinner
    Well assuming it is numeric, then the list would look like this:

    (T2.CTODNH In (11,71,72))

    Andy
    I tried but I am getting the following error:

    SQL0104 - Token .072 was not valid. Valid tokens: ,.

    This way, it works

    WHERE (T2.CTODNH In (011,071))

    This way, it doesn't

    WHERE (T2.CTODNH In (011,071,072))

    Thx.

  8. #8
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Quote Originally Posted by jacven
    SQL0104 - Token .072 was not valid. Valid tokens: ,.
    This error indicates you are still using the period (.) instead of the comma (,) for separating the numbers.

    Andy

  9. #9
    Join Date
    Oct 2007
    Posts
    13
    Quote Originally Posted by ARWinner
    This error indicates you are still using the period (.) instead of the comma (,) for separating the numbers.

    Andy
    Sorry Andy but I don't get it if I am using this

    WHERE (T2.CTODNH In (011,071))

    I am not using (.) to separate the numbers what could be wrong?

    Thx again.

  10. #10
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    If it is numeric, try removing the leading zeros from the numbers.

    Andy

  11. #11
    Join Date
    Oct 2007
    Posts
    13
    Hello Andy sorry to bother you again, nothing yet friend, still getting the same error, I tried what you mentioned. I am trying to extract the data from MS Query the option in Excel 2007, in the SQL statement I build my query there, does this have anything to do? thanks.

  12. #12
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Can you try the query using the CLP instead of Access?

    Andy

Posting Permissions

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