Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS SQL Server 2008 Link server query says "Invalid Object Name" but still works

The following query has a red squiggly underlining for the server through to the table this bit [OtherServer].[UAT_DB].[dbo].[profileTable] and when hovering says Invalid Object Name, but interestingly if I execute the line it returns the correct records from the linked server table:-

select * from [OtherServer].[UAT_DB].[dbo].[profileTable]
like image 654
John Avatar asked Sep 11 '13 07:09

John


People also ask

Why does SQL say invalid object name?

This typically means 1 of 2 things... you've referenced an object (table, trigger, stored procedure,etc) that doesn't actually exist (i.e., you executed a query to update a table, and that table doesn't exist). Or, the table exists, but you didn't reference it correctly...

How do I reference a linked server in SQL?

1 Open SQL Server Management Studio, navigate to the Object Explorer pane, and select Server Objects > Linked servers > Providers. 2 Right-click mrOledb. Provider and select Properties. 3 Select allow in process, and then click OK.

How do I change the name of my linked in server?

Go to start-administrative tools and open the data sources(odbc) then click on system dsn, here you will find the linked server dsn name. From here you can edit the properties of linked server. You can also test the connection.


1 Answers

Refreshing the local intellisense cache might fix it.

Whilst in a query window, either:

  • Press Ctrl + Shift + R
  • Go to the Edit menu -> Intellisense -> Refresh Local Cache
like image 51
Bridge Avatar answered Sep 30 '22 21:09

Bridge