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
0
votes
1 answer

Should I use a localhost linked server or the HOST_NAME() function to avoid hard-coding this SQL Server hostname?

I inherited a legacy system that has two SQL Server instances on the same server. Occasionally, some user action causes some records to be "synchronized" across the instances. The system uses a "linked server" so a sproc on the main instance can…
Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
0
votes
3 answers

Problem with select statement via a linked server

I am using MS SQL Server 2000 and have a link from a test db to a live db which is in replication. The link seems to work fine and I can select from any of the tables using any of the fields apart from the field with the constraints on creating ids.…
user107779
  • 41
  • 1
  • 2
  • 8
0
votes
0 answers

Link two servers to copy data

I'm trying to copy data from a DB in one server to a DB in another server. To copy data I know that I need to link the two servers, but nothing is working. I followed this link to link my two servers, but it returns me these error messages: OLE DB…
Camilla
  • 949
  • 2
  • 14
  • 26
0
votes
1 answer

Error while inserting data from SQL server to AS400 database using IBMDASQL provider for linked server

After I run a query I get the following error: OLE DB provider "IBMDASQL" for linked server "DB2400OLEDB" returned message "SQL7008: TABLE1 in STAGING not valid for operation. Cause . . . . . : **The reason code is 3.** Reason codes are: 1 --…
Sunil Chavan
  • 524
  • 5
  • 15
0
votes
0 answers

PostgreSQL query fails over PGNP provider for SQL Server

This query is failing in SQL Server over the PGNP provider: SELECT 1 AS x FROM pg_catalog.pg_attribute a LEFT OUTER JOIN pg_catalog.pg_index i ON (i.indrelid = a.attrelid AND a.attnum = i.indkey[a.attnum-1]) This is…
Jay Bienvenu
  • 3,069
  • 5
  • 33
  • 44
0
votes
1 answer

Inner join speed issue (Linked Server column)

I have a view (View A) that pulls in columns from a number of tables. It also pulls in a column from another view (View B) which gets its data from a Linked Server table. Now, View B runs fine, pulling back 11,000 rows in about a second. View A…
creatiive
  • 1,073
  • 21
  • 49
0
votes
0 answers

Importing from Excel / Excel Linked Server shows no data

This is a common problem I've had for years and I'm sure many others have experienced. Every time I search, I don't seem to get exactly what I'm needing, so I figure I'd just ask to see if anyone has an answer or at least point me to the place with…
0
votes
3 answers

Fully qualified table names with SP_ExecuteSql to access remote server

Trying to update a table on a linked server (SQL 2000/2005) but my server name will not be known ahead of time. I'm trying this: DECLARE @Sql NVARCHAR(4000) DECLARE @ParamDef NVARCHAR(4000) DECLARE @SERVER_NAME VARCHAR(35) SET @Sql =…
Dlongnecker
  • 3,008
  • 3
  • 25
  • 40
0
votes
2 answers

Best practice: handling errors in linked servers

I am using SQL Server 2008 R2 to connect to a number of other servers of the same type from within triggers and stored procedures. These servers are geographically distributed around the world and it is vital that any errors in communication between…
ose
  • 4,065
  • 2
  • 24
  • 40
0
votes
1 answer

Referencing linked server with instance

I have linked two SQL Servers and am trying to insert from one into the other. The issue is that the server I am inserting into is actually an instance (COMPANY\INSTANCE). When I run my code, how do I reference a table in the linked server? I have…
ose
  • 4,065
  • 2
  • 24
  • 40
0
votes
1 answer

MS Access, Pass through query with complex criteria. Criteria include Select statments and vba functions

I currently have multiple queries that query data from a few tables linked through ODBC, and some temporary tables that are edited through the user interface. I have complex criteria in my queries such as: SELECT * from ThingsData WHERE (Thing…
Matt
  • 339
  • 2
  • 6
  • 14
0
votes
0 answers

SQL Server linked server error 7303 to Access database

I've performed multiple searches and read numerous pages and tried loads of different configurations and nothing seems to solve a nuisance problem we have. We have a SQL server (2008 R2 v10.50.4000) that has several linked servers to several…
Anupheaus
  • 3,383
  • 2
  • 24
  • 30
0
votes
2 answers

How to get the list of tables that has specific columns from Oracle server.?

I am using SQL Server 2008 R2, I have access to an Oracle server from linked server with read-only access. Now I want to get the list of tables from the Oracle server which has specific column. For an example I want all the tables that have…
user2040021
  • 309
  • 3
  • 15
0
votes
0 answers

query templates while Linked Servers handling

In order to make single interface for app getting data from different datasources I created one stored procedure where I try to keep all data access/handling routines. Current situation: Sql Server sp receives fixed number of parameters and should…
revoua
  • 2,044
  • 1
  • 21
  • 28
0
votes
0 answers

SQL Server : Query Multiple Databases within Multiple Linked Servers, Return One result set

I have multiple linked servers, containing many databases. I'm trying to search through all the server/databases for specific information and return back one result set within SQL. I'm looking for a way without changing server settings/firewall to…