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
9
votes
4 answers

How to list all tables & columns names of a linked-server database in SQL Server?

If it's a regular database, i can simply use this query to get a list of all table names and their column names of the database. use [my_database_name] GO SELECT sys.tables.name AS Table_Name, sys.columns.name AS Column_Name, …
user3486647
  • 191
  • 1
  • 4
  • 12
9
votes
1 answer

SQL 2005 - Linked Server to Oracle Queries Extremely Slow

On my SQL 2005 server, I have a linked server connecting to Oracle via the OraOLEDB.Oracle provider. If I run a query through the 4 part identifier like so: SELECT * FROM [SERVER]...[TABLE] WHERE COLUMN = 12345 It takes over a minute to complete. …
John
  • 17,163
  • 16
  • 65
  • 83
9
votes
1 answer

SQL Server and Sybase Linked Server Issue

In SQL Server 2008 using the Sybase 12.5 driver everything works fine but now we had migrated to SQL Server 2012 and Sybase 15 using the 64bit driver it seems that things are broken. If I test linked server connection it gives me linked server…
Raymund
  • 7,684
  • 5
  • 45
  • 78
9
votes
4 answers

How can I connect to an external database from a sql statement or a stored procedure?

When running a SQL statement or a stored procedure on a database, can you connect to an external database and pull data from there? something like: SELECT a.UserID, b.DataIWantToGet FROM mydb.Users as a, externaldb.Data as b
Matt
  • 5,547
  • 23
  • 82
  • 121
9
votes
2 answers

SQL Server 2012: Add a linked server to PostgreSQL

I try to connect a PostgreSQL to SQL Server 2012 server as linked server I found some advices on different forum and follow it. But I'm stuck with an authentication problem. I explain: On the SQL Server, I have install the ODBC driver for PostgreSQL…
9
votes
9 answers

Linked Server Performance and options

At work we have two servers, one is running an application a lot of people use which has an SQL Server 2000 back end. I have been free to query this for a long time but can't add anything to it such as stored procedures or extra tables. This has…
PeteT
  • 18,754
  • 26
  • 95
  • 132
8
votes
5 answers

Stored Procedure and populating a Temp table from a linked Stored Procedure with parameters

I have a Stored Procedure (SP) in which I pass in one value. In this SP, I am trying to create/populate a Temp Table from the result of another SP that is on a Linked/remote server. That is I am trying to executute an SP in my SP and populate a temp…
R M
  • 119
  • 1
  • 4
  • 9
8
votes
3 answers

View linked server dependencies sql server 2008

Does any know how / if it is possible to view all tables/views/stored procedures that depend on a linked server in Sql Server 2008. Basically as if the context menu "View dependencies" was accessible for linked servers? Any help much…
Peuge
  • 1,461
  • 5
  • 20
  • 37
8
votes
2 answers

SQL Server Linked Server with tnsnames.ora on network share - ORA: 12154

Having an issue getting a SQL Server linked server to Oracle working while using a tnsnames.ora file on a network share. If I copy the tnsnames.ora file to the local server, the linked servers work fine. However, we keep the file on a network…
Sam
  • 7,543
  • 7
  • 48
  • 62
8
votes
1 answer

MySQL Linked Server can't update longtext

I have a Linked Server from SQL Server to my mySQL database (Windows Server using MySQL ODBC Driver 5.3). I have a unique situation where I can only get my longtext columns to return if I convert them in an OPEN QUERY: SELECT * FROM OPENQUERY…
Paul D
  • 676
  • 6
  • 8
8
votes
3 answers

SQLSMS Intellisense on linked server

I'm trying to work Microsoft SQL Server Management Studio 10.0.5538.0 (latest right now) with Intellisense on linked servers, for example: SELECT Column FROM [LinkedServer].DatabaseName.dbo.Table WITH(NOLOCK) But I couldn't find a way to make…
Jorge
  • 113
  • 1
  • 8
8
votes
4 answers

Slow query when connecting to linked server

I've got this query UPDATE linkeddb...table SET field1 = 'Y' WHERE column1 = '1234' This takes 23 seconds to select and update one row But if I use openquery (which I don't want to) then it only takes half a second. The reason I don't want to use…
Jamie Taylor
  • 3,500
  • 21
  • 65
  • 99
8
votes
3 answers

Escape single quote in openquery using dynamic query

I need to retrieve data from a linked server using a parameter, @PickedDate for example. The query works fine if I skip @A and @B, but it always returns an error due to a missing single quote. Please advise, thanks. The query: Declare @OPENQUERY…
Weihui Guo
  • 3,669
  • 5
  • 34
  • 56
8
votes
2 answers

Exec SP on Linked server and put that in temp table

Need some help on the below issue: Case 1 : stored procedure is on server 1 - call is from server1 declare @tempCountry table (countryname char(50)) insert into @tempCountry exec [database1_server1].[dbo].[getcountrylist] Select * from…
user1431921
  • 101
  • 1
  • 2
  • 5
8
votes
5 answers

Is it possible to create a temp table on a linked server?

I'm doing some fairly complex queries against a remote linked server, and it would be useful to be able to store some information in temp tables and then perform joins against it - all with the remote data. Creating the temp tables locally and…
Herb Caudill
  • 50,043
  • 39
  • 124
  • 173