How to query a server linked via ODBC

linked-serverodbcssms

I've looked at multiple other questions about querying linked servers, but nothing has worked for my setup.

Notes:

  • I'm not using localdb at all. I just wanted to use SQLSMS for a remote cache database that is only accessible via the Intersystems ODBC driver.
  • I edited out the actual table names, but they all have periods in them.
  • MyDSN is not the actual DSN name.

Here is the structure and below the image are some of the things I've tried:

enter image description here

SELECT * FROM [MyDSN].[default].[Table.name]

Invalid object name 'MyDSN.default.Table.name'.

SELECT * FROM [localdb].[MyDSN].[default].[Table.name]

Could not find server 'localdb' in sys.servers.

SELECT * FROM [MyDSN].[default].dbo.[Table.name]

The OLE DB provider "MSDASQL" for linked server "MyDSN" does not contain the table ""default"."dbo"."Table.name"".

SELECT * FROM [MyDSN]..[default].[Table.Name]

The OLE DB provider "MSDASQL" for linked server "MyDSN" does not contain the table ""default"."Table.Name"".

SELECT * FROM [MyDSN].[default].[Table].[Name]

Invalid object name 'MyDSN.default.Table.name'.

Also, if I right-click on one of the tables and pick "Script table as SELECT" I get the following error:

enter image description here

Best Answer

Try Open query

BEGIN TRANSACTION;

select top 10  * 
INTO #t
from openquery ("YOUR LINKED SERVER NAME",'SELECT   * FROM [SOURCE TABLE NAME]);

COMMIT