1

I have created a Linked server through LAN,

Linked server Name-[DELL-PC]

Here, I'm not able to run this query to select Values from Linked server

case :1
    select *From  [DELL-PC].[BTS_Server].[dbo].Assy_ProductionOrder_ParameterSetting
    select *From  [DELL-PC].[BTS_Server]..Assy_ProductionOrder_ParameterSetting

it says:

"Invalid object name 'BTS_Server.dbo.Assy_ProductionOrder_ParameterSetting'."

but if i use openquery, it is working smoothly

case :2
    select * 
    From openquery([DELL-PC],
    'Select *From [BTS_Server].[dbo].Assy_ProductionOrder_ParameterSetting ');

How do i access linked server Table like case 1 statements, kindly assist me.

King_Fisher
  • 1,171
  • 8
  • 21
  • 51

3 Answers3

1

Check if your table contains XML column, if yes this syntax won't work.

SELECT * FROM [server].[database].[scheme].[table]

Possible workarounds:

  1. Create view without the XML column(s) on remote server and query that.

  2. Use a pass-through query in the form SELECT * from OPENQUERY (... )

Another possible answer:

Architecture mismatch 32/64-bit when inappropriate OLE DB Provider is used:

32 bit machines ARE able to query the linked server without using OPENQUERY. It is the 64-bit that must use OPENQUERY

Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275
0

Like below

select * from LinkServername.Databasename.dbo.TableName

But make sure you have valid user and password to access the link server. This is done when you are creating link.

0

In my case, linked server name contains IP address, so see https://stackoverflow.com/a/60188969/9117945 for more types.

  • This is not an answer but a comment please visit and check [how to answer a question](https://stackoverflow.com/help/how-to-answer). – Yunus Temurlenk Feb 12 '20 at 13:27