Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Linked Server - Works Except With Insert Statement


Linked Server - Works Except With Insert Statement

Author
Message
homebrew01
homebrew01
SSCrazy
SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)

Group: General Forum Members
Points: 2986 Visits: 9071
I am trying to get Job information from ServerB, and populate a Table Variable on ServerA. From ServerA, I am running the following command with a Linked Server to ServerB.

If I run this by itself from ServerA, I get the expected results in the query window. And if I insert into a table variable from the local server it works file

EXECUTE [LinkedServer_B].master.dbo.xp_sqlagent_enum_jobs 1,''



But when I try the 2nd block of code inserting into the table variable from the linked server, I get an error.

DECLARE @currently_running_jobs TABLE (
job_id UNIQUEIDENTIFIER NOT NULL
,last_run_date INT NOT NULL
,last_run_time INT NOT NULL
,next_run_date INT NOT NULL
,next_run_time INT NOT NULL
,next_run_schedule_id INT NOT NULL
,requested_to_run INT NOT NULL
,request_source INT NOT NULL
,request_source_id SYSNAME COLLATE database_default NULL
,running INT NOT NULL
,current_step INT NOT NULL
,current_retry_attempt INT NOT NULL
,job_state INT NOT NULL ) -- 0 = Not idle or suspended, 1 = Executing, 2 = Waiting For Thread, 3 = Between Retries, 4 = Idle, 5 = Suspended, [6 = WaitingForStepToFinish], 7 = PerformingCompletionActions

--Capture Jobs currently working
INSERT INTO @currently_running_jobs
EXECUTE [LinkedServer_B].master.dbo.xp_sqlagent_enum_jobs 1,''



ERROR:

OLE DB provider "SQLNCLI10" for linked server "LinkedServer_B" returned message "The partner transaction manager has disabled its support for remote/network transactions.".
Msg 7391, Level 16, State 2, Line 21
The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "LinkedServer_B" was unable to begin a distributed transaction.




Geoff A
Geoff A
SSChasing Mays
SSChasing Mays (612 reputation)SSChasing Mays (612 reputation)SSChasing Mays (612 reputation)SSChasing Mays (612 reputation)SSChasing Mays (612 reputation)SSChasing Mays (612 reputation)SSChasing Mays (612 reputation)SSChasing Mays (612 reputation)

Group: General Forum Members
Points: 612 Visits: 1793
I have never been able to do that. regardless of MS DTC settings or the sp_configure settings of remote proc trans.....


the way i get around it is using sqlcmd to call a saved .sql file that does the work i need / want.

in this case (you want results of an extended stored procedure).
I would create a .sql file that creates a temp stored procedure to create a table in the tempdb on the remote server and then insert the results of the extended stored procedure into this tempdb table.
once the results are in the remote servers tempdb, i can then just run a select into statement with 4 part naming on the local server to get the data.


if someone else knows how to get around this, I would love to hear about it.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search