Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.

Răspuns Can't get data using a linked server

  • 13 martie 2012 20:12
     
      Are cod

    Hey everyone!

    So I've been going at this for a few hours now and I am starting to lose it so I'm turning to you guys :P

    Basically, I am trying to query data using an openquery with a linked server but it is not working. Here is what I am doing and the returned error:

    SELECT * FROM OPENQUERY(REMEDY,'SELECT ID_de_demande,Date_de_création,Date_de_modification,NomGroupe,TechAffecte,TokenChangeID FROM FM0047___CC_GroupeTechAffecté WHERE TokenChangeID LIKE ''' + @token + '''')

    The error being returned is this:

    OLE DB provider 'MSDASQL' for linked server 'REMEDY' returned data that does not match expected data length for column '[MSDASQL].NomGroupe'. The (maximum) expected data length is 30, while the returned data length is 31.

    I have tried to fix this in many ways (using cast, substr, mid, left...with and without the {fn }) but nothing works. All I get when I do this is this error:

    OLE DB provider "MSDASQL" for linked server "REMEDY" returned message "[AR System ODBC Driver]Expected lexical element not found: <identifier>".

    So that's it. I am completely out of ideas and will be very grateful to whomever helps me solve this :)

    Thanks and have a nice day!

    -Jrvd

Toate mesajele

  • 15 martie 2012 02:54
     
     Răspuns

    Hi Jrvd,

    Could you please elaborate a bit? What does the linked server ‘REMEDY’ point to? SQL Server, MySQL or Oracle? What’s the data type and length of NomGroupe? 

    Usually, we need to use a CONVERT/CAST function or a string function to make it match the expected data length.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Get or Request Code Sample from Microsoft
    If you have any feedback, please tell us.

    • Marcat ca răspuns de KJian_ 21 martie 2012 02:37
    •