Linked Server

  • I am using linked server to  make a query. ( eg. SELECT * FROM OPENQUERY(dump, 'SELECT Name,Surname,City FROM Person')

    It goes fine however when I select the file which has 2 word

    (eg. SELECT * FROM OPENQUERY(dump, 'SELECT Name,Surname,[Post Code} FROM Person')

     

     

    The error message below appears

     “Server: Msg 7399, Level 16, State 1, Line 12

    OLE DB provider 'MSDASQL' reported an error. 

    [OLE/DB provider returned message: [Dump][ODBC Driver]Column not found: [Post]

    OLE DB error trace [OLE/DB Provider 'MSDASQL' ICommandPrepare:repare returned 0x80004005:

     

    It seems the query can’t accept 2 words.

    What should I do? Do you think it is an error during my linked server setup?

     

    Please help me  

     

    Susan

     

  • Er, just out of curiosity, does your original SQL have the curly bracket } at the end? Because, it should have square brackets on both sides.

  • No,

     just wrong typo in this question but in the actual I used [].

    some advises me to use DBCC TRACEON(8765) and DBCC TRACEOFF(8765)  then instead of [] I need to use " "

    It works OK.

    But I don't know why I should use this?

    Ta,

    Susan

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

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