linked-server

Transaction context in use by another session

孤者浪人 提交于 2019-12-01 02:55:34
I have a table called MyTable on which I have defined a trigger, like so: CREATE TRIGGER dbo.trg_Ins_MyTable ON dbo.MyTable FOR INSERT AS BEGIN SET NOCOUNT ON; insert SomeLinkedSrv.Catalog.dbo.OtherTable (MyTableId, IsProcessing, ModifiedOn) values (-1, 0, GETUTCDATE()) END GO Whenever I try to insert a row in MyTable , I get this error message: Msg 3910, Level 16, State 2, Line 1 Transaction context in use by another session. I have SomeLinkedSrv properly defined as a linked server (for example, select * from SomeLinkedSrv.Catalog.dbo.OtherTable works just fine). How can I avoid the error and

Linked servers SQLNCLI problem. “No transaction is active”

﹥>﹥吖頭↗ 提交于 2019-12-01 00:36:56
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 to begin a distributed transaction. OLE DB provider "SQLNCLI" for linked server "MyServerName" returned message "No transaction is active.". My query looks like this: INSERT INTO #TABLE EXEC MyServerName.MyDatabase.dbo.MyStoredProcedure Param1, Param2, Param3 Exact column number, names, the problem is not the result. MSDTC is allowed and started in

Executing remote procedure with user-defined table type variable parameter

自古美人都是妖i 提交于 2019-11-30 23:05:27
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 server. This is what I'm trying so far, but it doesn't work: DECLARE @tblVar [REMOTESERVER].REMOTEDB.dbo.user_defined_table_type EXEC [REMOTESERVER].REMOTEDB.dbo.procedure_name (@param1 = @tblVar) However the error I'm getting is: The type name 'REMOTESERVER.REMOTEDB.dbo' contains more than the maximum number of prefixes. The maximum is 1. Must

Executing remote procedure with user-defined table type variable parameter

柔情痞子 提交于 2019-11-30 18:24:58
问题 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 server. This is what I'm trying so far, but it doesn't work: DECLARE @tblVar [REMOTESERVER].REMOTEDB.dbo.user_defined_table_type EXEC [REMOTESERVER].REMOTEDB.dbo.procedure_name (@param1 = @tblVar) However the error I'm getting is: The type name

Linked servers SQLNCLI problem. “No transaction is active”

元气小坏坏 提交于 2019-11-30 18:17:13
问题 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 to begin a distributed transaction. OLE DB provider "SQLNCLI" for linked server "MyServerName" returned message "No transaction is active.". My query looks like this: INSERT INTO #TABLE EXEC MyServerName.MyDatabase.dbo.MyStoredProcedure Param1, Param2

Linked Server Insert-Select Performance

旧街凉风 提交于 2019-11-30 14:01:09
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 Local_Table to Remote_Table with this query: Insert into RemoteServer.RemoteDb..Remote_Table select * from Local_Table (nolock) But the performance is quite slow. However, when I use SQL Server import-export wizard, transfer is really fast. What am I doing wrong? Why is it fast with Import-Export wizard and slow with insert-select statement? Any ideas? The

Linked SQL Server database giving “inconsistent metadata” error

最后都变了- 提交于 2019-11-30 13:45:54
问题 I am currently running a third-party software suite, which uses SQL Server as its database. I have a second instance of SQL Server running in a different location, and some apps that I am building in that instance SQL Server needs to access some data in the third-party software. So, I created an ODBC connection between the boxes, and set up the third-party SQL server as a linked server on my version of SQL Server. As a test, I ran something like the following statement from my SQL server,

SQL Server 2012: Add a linked server to PostgreSQL

﹥>﹥吖頭↗ 提交于 2019-11-30 13:45:43
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 (psqlodbc_09_02_0100-x64). I created a system DSN to a specific database on the PostgreSQL. This DSN work correctly. Using SSMS, I run this command to add the linked server: EXEC master.dbo.sp_addlinkedserver @server = N'lnk_test', @srvproduct=N'PostgreSQL Unicode(x64)', @provider=N'MSDASQL', @provstr=N'Driver=PostgreSQL Unicode(x64);uid=postgres

View linked server dependencies sql server 2008

拈花ヽ惹草 提交于 2019-11-30 09:28:12
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 appreciated. Thanks Search for it SELECT OBJECT_NAME(object_id), * FROM sys.sql_modules WHERE definition LIKE '%myLinkedServer%' Or use the free Red gate SQL Search to do the same with a GUI There is no table or feature that tracks dependencies between the server-level linked server objects and database-level objects Note: INFORMATION_SCHEMA views and the legacy

Workaround for calling table-valued function remotely in SQL Server has even more issues

♀尐吖头ヾ 提交于 2019-11-30 08:48:04
I had a query with a set of parameters that needed to be run multiple times with different parameters, so I wrapped it in a table-valued function. That table valued function needed called from a remote server. Unfortunately, the call fails on the linked server with the error: Msg 4122, Level 16, State 1, Line 29 Remote table-valued function calls are not allowed. Microsoft has acknowledged that "calling a table-valued function remotely" was a feature left out of SQL Server 2008. See: http://connect.microsoft.com/SQLServer/feedback/details/276758/remote-table-valued-function-calls-are-not