Insert statement fails via Server link with DB2

  • We have a server link through which we are inserting data, that fails with the following error:

    OLE DB provider "IBMDASQL" for linked server "BPCSORA64" returned message "SQL0104: Token ,0 was not valid. Valid tokens: ) ,.

    Cause . . . . . : A syntax error was detected at token ,0. Token ,0 is not a valid token. A partial list of valid tokens is ) ,. This list assumes that the statement is correct up to the token. The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery . . . : Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token ,0. Correct the statement. The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses. -- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause.".

    Msg 7215, Level 17, State 1, Line 1Could not execute statement on remote server 'BPCSORA64'.

    .

    A select statement works.

    .

    The exact insert statement works from a test SQL Server with the same sever link (BPCSORA64).

    The server link configuration is identical in both the test and production servers.

    What are we missing? Where else should we look for the difference in config?

  • The insert statement:

    EXEC('INSERT INTO V61MMF.GCC ( GCCID, CCNVDT, CCNVFC, CCFRCR,

    CCTOCR, CCRTYP, CCUSER, CCDATE, CCTIME, CCCNV2, CCCMET)

    VALUES(''CC'' , 20120502 ,0.7804900 ,''AUD'' ,''EUR'' ,

    ''SPOT'' ,''ORACLEADD'' ,20120504 ,145719 ,1 ,''7'')') at BPCSORA64

  • Workaround / alternative insert statement works from both production and test:

    Insert into BPCSORA64.BPCS60CS.V61MMF.GCC(GCCID,

    CCNVDT,

    CCNVFC,

    CCFRCR,

    CCTOCR, CCRTYP, CCUSER, CCDATE, CCTIME, CCCNV2, CCCMET, CCLOCK) VALUES('CC' , 20120502 ,0.7804900,'AUD' ,'EUR' ,'SPOT',

    'ORACLEADD' ,20120504 ,145719 ,1 ,'7', '1')

    Can someone explain to me the difference between this type of insert statement and the EXEC('INSERT ....') at BPCSORA64 ?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply