Questions tagged [linked-server]

The SQL Server "linked server" feature makes it possible to execute commands, such as a SELECT statement, on a remote server.

Use this tag for any questions related to SQL Server's linked server feature.

A linked server configuration enables SQL Server to execute commands against OLE DB data sources on remote servers. Linked servers offer the following advantages:

  • Remote server access.
  • The ability to issue distributed queries, updates, commands, and transactions on heterogeneous data sources across the enterprise.
  • The ability to address diverse data sources similarly.

An OLE DB provider is required for this functionality to work.

See MSDN for more information.

1493 questions
4
votes
3 answers

How can I call Scalar user defined function from linked server?

I have to run a query from linked server (SQL Server 2008) that contains Scalar UDF (with one parameter) on that server, when I run the query I got following error Cannot find either column "PSW_Local" or the user-defined function or aggregate…
GK1960
  • 111
  • 2
  • 4
  • 15
4
votes
4 answers

Linked servers SQLNCLI problem. "No transaction is active"

Im trying to execute a stored procedure and simply insert its results in a temporary table, and I'm getting the following message: The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "MyServerName" was unable…
Smur
  • 3,075
  • 7
  • 28
  • 46
4
votes
3 answers

Performance of inter-database query (between linked servers)

I have an import between 2 linked servers. I basically got to get the data from a multiple join into a table on my side. The current query is something like this: select a.* from db1.dbo.tbl1 a inner join db1.dbo.tbl2 on ... inner join…
Ash
  • 1,269
  • 3
  • 25
  • 49
4
votes
2 answers

Invalid column definition error when using four part name to access Oracle DB as SQL Server linked server

I have setup a linked server in SQL Server 2008 R2 in order to access an Oracle 11g database. The MSDASQL provider is used to connect to the linked server through the Oracle Instant Client ODBC driver. The connection works well when using the…
sglantz
  • 2,063
  • 4
  • 20
  • 30
4
votes
2 answers

TRY CATCH with Linked Server in SQL Server 2005 Not Working

I am trying to catch sql error raised when I execute a stored procedure on a linked server. Both Servers are running SQL Server 2005. To prove the issue I have created a stored procedure on the linked server called Raise error that executes the…
4
votes
1 answer

Is there a way to query SQL Server linked server without hardcoding database name?

I found samples where the code: SELECT * FROM [legacyserver].[database].[schema].[table] was expressed as: SELECT * FROM [legacyserver]...[table] but isn't working for me. It gives me the error: An invalid schema or catalog was specified for the…
sergiogarciadev
  • 2,061
  • 1
  • 21
  • 35
4
votes
4 answers

quering remote database using sql server?

I have used sp_addlinkedserver to access the remote machines db now i am writing queries explicitly on database like, select * from [server\instance].database.owner.tablename Now with this, [Server\instance] : this has to be provided…
Anil Namde
  • 6,452
  • 11
  • 63
  • 100
4
votes
1 answer

SQL Server Linked Server to Microsoft Access

I have tried to make use of linked servers in SQL Server 2008 by doing the following to access a Microsoft Access 2003 Table. EXEC sp_addlinkedserver access1t, 'OLE DB Provider for Jet', 'Microsoft.Jet.OLEDB.4.0', 'C:\tester.mdb' EXEC…
Abs
  • 56,052
  • 101
  • 275
  • 409
4
votes
2 answers

How to update row in SQL server using linked MySql server

I created linked server between sql server and mysql.It will work fine for me. My question is when insert row in mysql table that time i want to update row in sql server table, Like in mysql table name 'abc' when in this table new row insert that…
Panchotiya Vipul
  • 1,226
  • 5
  • 17
  • 42
4
votes
3 answers

How to query against multiple linked servers?

After linking some SQL Server 2008 Servers / instances, I would like to do a more generic query against these servers. I know that I must specify the destiny of the query like that: select * from [SRV\INSTANCE].dbname.dbo.foo But, I would run this…
cezarlamann
  • 1,465
  • 2
  • 28
  • 43
4
votes
1 answer

Trigger between linked servers

I have two SQL Server 2008 machines, SQLSERVER1 and SQLSERVER2 (soo original) In SQLSERVER2, I do: [SQLSERVER1].[DATABASE].[DBO].StoreProcedure1 All works well. But if I put into a trigger, I receive this error OLE DB provider "SQLNCLI10" for…
4
votes
2 answers

Problem with SQL subquery using Top() on Linked Server

I am using SQL Server 2008 and I have the following SQL script: Select o.CustomerId as CustomerNoId, OrderValue, OrderDate From dbo.Orders as o Inner Join ( Select Top (10) CustomerId From dbo.Customers where Age < 60 ) As c On…
TonE
  • 2,975
  • 5
  • 30
  • 50
4
votes
1 answer

Executing remote procedure with user-defined table type variable parameter

I'm trying to call a remote stored procedure over a linked server. The problem is, one of the required parameters is a user-defined table types. I can't seem to figure out how to declare a local variable as a user-defined table type from a remote…
3
votes
3 answers

SQL - Connect to Linked Server with Named Instance

How do I connect to a named instance of a linked SQL server. If its not linked, I would do the following: ServerName.DatabaseName.dbo.TableName If it is linked, I would assume the following: ServerName\InstanceName.DatabaseName.dbo.TableName but…
Miles
  • 5,646
  • 18
  • 62
  • 86
3
votes
0 answers

SQL SERVER error Cannot initialize the data source object of OLE DB provider "SQLNCLI11" for linked server "xxxxxxx"

In SQL server 2016 I've created a linked server from another SQL server I made a view looking for data in che DB of linked server. From SSMS or from my app the view fail to retrive data first time, if I repeat same view a second time it works…