Search code examples
sql-serverodbclinked-server

"Invalid object name" when executing a query from a linked server on SQL


I have created linked servers on SSMS before but I am having trouble with this particular server. The linked server has come back as successfully connected and I can see the available tables, however, when I do a simple select query it's as if it cannot locate any of the tables within the database.

Would anyone have any clue as to why i'm receiving this error ?

SELECT * FROM [AMP].[default].[Import_records]
Msg 208, Level 16, State 1, Line 4
Invalid object name 'AMP.default.Import_records'.

Solution

  • Perhaps you would be better off with OPENQUERY:

    SELECT *
    FROM OPENQUERY(N'AMP',N'SELECT * FROM default.Import_records')OQ;
    

    You will be able to do this with 4 part naming, however, we're not getting the information we need to able be able to really answer with that solution.