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
8
votes
5 answers

sql server linked server to oracle returns no data found when data exists

I have a linked server setup in SQL Server to hit an Oracle database. I have a query in SQL Server that joins on the Oracle table using dot notation. I am getting a “No Data Found” error from Oracle. On the Oracle side, I am hitting a table (not…
Don Chambers
  • 3,798
  • 9
  • 33
  • 74
8
votes
1 answer

How to find which OLE provider is available for SQL Server?

I try to access an Excel file in SSMS. After searching the internet, I could not get it working. Here is what I did: My environment: Windows 7(64bit) SP 1, Microsoft SQL Server 2008 (SP3) - 10.0.5500.0 (X64) Office 2010 Pro Plus with Access…
KentZhou
  • 24,805
  • 41
  • 134
  • 200
8
votes
6 answers

Linked Server Insert-Select Performance

Assume that I have a table on my local which is Local_Table and I have another server and another db and table, which is Remote_Table (table structures are the same). Local_Table has data, Remote_Table doesn't. I want to transfer data from…
Mehmet
  • 1,435
  • 4
  • 13
  • 15
7
votes
2 answers

Inserting Results Of Stored Procedure From Linked Server

Is it possible to insert the results of a remote stored procedure into a temp table? For example CREATE TABLE #test(id INT) INSERT INTO #test EXEC [linkedserver].remoteDB.dbo.tst DROP TABLE #test Where tst is a stored procedure that returns…
Gavin
  • 17,053
  • 19
  • 64
  • 110
7
votes
2 answers

OLE DB provider 'for linked server returned data that does not match expected data length for

I get an error querying a remote postgresql server from my sql server 2017 Standard via a linked server this is the query: SELECT CAST(test AS VARCHAR(MAX)) FROM OpenQuery(xxxx, 'SELECT corpo::TEXT as test From…
Gabriele D'Onufrio
  • 405
  • 1
  • 5
  • 17
7
votes
2 answers

Localdb linked servers

I'm trying to replicate a production environment locally and the production database uses a linked server. I've been able to create multiple instances of localdb; is it possible to create a linkedserver between localdb instances? If not, what other…
Dave
  • 3,581
  • 1
  • 22
  • 25
7
votes
2 answers

Distributed Transaction on Linked Server between sql server and mysql

I have a table say Table1 on SQL Server 2014 and MySQL both. Table1 ID INT,Code VARCHAR(100) I created a linked server MyLinkedServer in SQL Server using "Microsoft OLEDB Provider for ODBC". **Linked Server ** EXEC master.dbo.sp_addlinkedserver…
ughai
  • 9,830
  • 3
  • 29
  • 47
7
votes
1 answer

Execute query to linked server as another user

I'd like to execute a query which uses linked server as a specific user. However, not even a simple example works. When I opem SSMS as user "domain\user", connect to "serverA" and run following code: EXECUTE ('SELECT col FROM…
dpelisek
  • 884
  • 3
  • 13
  • 22
7
votes
1 answer

Can I join data from 2 different DB2 databases? (Like SQL Server linked databases)

I'm enhancing an existing java application. There is data in 2 different DB2 databases. The app already gets data from 2 different databases, but it always does a lookup from one and then the other. Is there a way to join data from 2 different…
Jess
  • 23,901
  • 21
  • 124
  • 145
7
votes
3 answers

Creating a Linked Server and Database Alias

I have two servers Server1 and Server2 On both servers i have a Database called QAI is there a way that i can create a linked server with an alias from Server2 to Server1 but instead of Server1.QAI.dbo.tbBlah Have it aliased as QAI.dbo.tbBlah This…
telsokari
  • 213
  • 2
  • 5
  • 12
6
votes
4 answers

INNER JOIN on Linked Server Table much slower than Sub-Query

I came across this very odd situation, and i thought i would throw it up to the crowd to find out the WHY. I have a query that was joining a table on a linked server: select a.*, b.phone from table_a a, join remote.table_b b on b.id = a.id (lots…
Limey
  • 2,642
  • 6
  • 37
  • 62
6
votes
1 answer

Is there a way to prevent SQL Server from Validating the SQL in a stored procedure during CREATE / ALTER

One aspect of our system requires our SQL Server instance to talk to a MySQL Server via a linked Server Connection. MSSQL -> LinkedServer(MSDASQL ODBC Provider) -> MySQL ODBC Connector -> MySQL DB The Table on the linked server is called in a SPROC…
Eoin Campbell
  • 43,500
  • 17
  • 101
  • 157
6
votes
1 answer

Cannot connect to SQL Azure using a Linked Server

I've been following this article here: http://blogs.msdn.com/b/sqlcat/archive/2011/03/08/linked-servers-to-sql-azure.aspx on how to setup a Linked Server from SQL Server 2008 R2 to an SQL Azure instance. I am using SQL Native Client 10.0 as the…
Luke Merrett
  • 5,724
  • 8
  • 38
  • 70
6
votes
2 answers

Connecting to Sphinx from sql server linked server

I am trying to connect to Sphinx from SQL Server Management Studio as a Linked server. I tried the following query: EXEC master.dbo.sp_addlinkedserver @server=N'SPHINX_SEARCH', @srvproduct=N'', @provider=N'MSDASQL', @provstr=N'Driver={MySQL ODBC 8.0…
Yahfoufi
  • 2,220
  • 1
  • 22
  • 41
6
votes
1 answer

SQL Server 2008: What is lazy schema validation?

Saw this option when I made a linked server
Bill
  • 135
  • 2
  • 2
  • 4