linked-server

inserting to a local table from a linked stored procedure

前提是你 提交于 2019-12-10 20:02:23
问题 I have a sproc that is called from .net code which does an update on a local table and then is supposed to insert to a different local table values that are obtained from a remote procedure call to a linked server. I get this error message every time I try to insert the results from the linked server. If i take out the insert into statement, but leave the remote procedure call in place, it works fine. Here is the error: System.Data.SqlClient.SqlException: The operation could not be performed

OpenQuery from SQL Server to Oracle server hangs indefinitely if connection is lost

久未见 提交于 2019-12-10 19:23:03
问题 I have a scheduled job which runs on a SQL Server 2005 database. It runs a stored proc which imports data from a View. This View consists of an OPENQUERY to a linked Oracle server. I have no control over the Oracle server - it is both geographically and virtually separated from the Sql Server installation. The View just has read-only access and I grab the data from it every 30 mins. On occasion, the connection to the linked server will either drop, hang or be otherwise unresponsive. When this

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

て烟熏妆下的殇ゞ 提交于 2019-12-10 18:47:01
问题 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, sys.columns.max_length, (schema_id) As Schema_name FROM sys.tables INNER JOIN sys.columns ON sys.tables.OBJECT_ID=sys.columns.object_id ORDER BY schema_name, sys.tables.name, sys.columns.name but right now I need to connect to a linked-server database therefore the 'use'

Very Slow SQL Update using a Linked Server

依然范特西╮ 提交于 2019-12-10 17:57:09
问题 I have a sql script running on a server (ServerA) This server, has a linked server set up (ServerB) - this is located off site in a datacenter. This query works relatively speeidily: SELECT OrderID FROM [ServerB].[DBName].[dbo].[MyTable] WHERE Transferred = 0 However, when updating the same table using this query: UPDATE [ServerB].[DBName].[dbo].[MyTable] SET Transferred = 1 It takes > 1 minute to complete (even if there's only 1 column where Transferred = 0) Is there any reason this would be

Insert into table on the Linked Server with data from local table

。_饼干妹妹 提交于 2019-12-10 17:32:52
问题 I'm working with SQL Server Express, I created a linked server to an Oracle database. As the title indicates, I want to insert data selected from a local table into a table at the Linked Server. I tried many queries but no one of them worked as I want. This query below I used has worked, but only with static values, but I want to insert data dynamically from the a table on local database. INSERT OPENQUERY (ORTEST, 'SELECT * FROM reservation') VALUES (2, '2', 3); 回答1: It is normal that it

SQL Server Error: maximum number of prefixes. The maximum is 3. with join syntax

亡梦爱人 提交于 2019-12-10 16:56:30
问题 Trying to run a cross-server update: UPDATE ASILIVE.CustomerManagementSystem.dbo.Sessions SET ASILIVE.CustomerManagementSystem.dbo.Sessions.VarianceAmount=Variances.VarianceAmount FROM ASILIVE.CustomerManagementSystem.dbo.Sessions INNER JOIN Variances ON ASILIVE.CustomerManagementSystem.dbo.Sessions.SessionGUID = Variances.SessionGUID WHERE ASILIVE.CustomerManagementSystem.dbo.Sessions.VarianceAmount <> Variances.VarianceAmount Gives the error: Msg 117, Level 15, State 2, Line 5 The number

Inserting Results Of Stored Procedure From Linked Server

跟風遠走 提交于 2019-12-10 13:12:24
问题 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 IDs. If I run the exec on its own it works fine EXEC [linkedserver].remoteDB.dbo.tst However when I put it as part of an insert I get this error " OLE DB provider "SQLNCLI" for linked server "linkedserver" returned message "The partner transaction manager

OPENDATASOURCE instead of Linked Server

情到浓时终转凉″ 提交于 2019-12-10 11:17:13
问题 I have a situation where a linked server to an access DB is crashing my SQL server. Crashed here means adding the linked server causes all other linked servers using that provider to stop working. Any queries to those linked servers hang and don't complete. This situation persists until the server is restarted. However, when I use OPENDATASOURCE to connect to the same data source I don't have this problem. Why would one work and the other crash? The provider I'm using is Microsoft.ACE.OLEDB

Having trouble adding a linked SQL server

早过忘川 提交于 2019-12-10 02:39:59
问题 I'm trying to pull in data from a remote SQL Server. I can access the remote server using SQL authentication; I haven't had any luck using the same credentials with sp_addlinkedserver. I'm trying something like this: Exec sp_dropserver 'Remote', 'droplogins' go EXEC sp_addlinkedserver @server='Remote', @srvproduct='', @provider='SQLNCLI', @datasrc='0.0.0.0' EXEC sp_addlinkedsrvlogin @useself='FALSE', @rmtsrvname='Remote', @rmtuser='User', @rmtpassword='Secret' Select Top 10 * from Remote

Linked server setup between SQL Server Express and SQL Server

馋奶兔 提交于 2019-12-09 06:36:25
Can you please explain how to setup a linked server between a SQL Server (A) and a SQL Server Express (B) scenario. Server A is SQL Server 2000, whereas Server B is SQL Server 2005 Express. I have set these up in the past, but none where connected to a SQL Server Express version. Thanks, Billy You can use this sp to do it. EXEC sp_addlinkedsrvlogin @rmtsrvname = 'MylinkedServer', @useself = 'FALSE', @locallogin = NULL, @rmtuser = 'me', @rmtpassword = 'myrmtpassword' Shiraz Bhaiji You could try using the sp_addlinkedserver stored procedure: https://web.archive.org/web/1/http://blogs