On server A, create the following:[code="sql"]create proc remotetest3 (@a int)asset nocount onselect object_idfrom sys.objectswhere object_id < @aRETURNGO[/code]On server B, make a linked server to server A, then run the following:[code="sql"]drop table #tmpgocreate table #tmp (object_id int)goinsert #tmpexecute serverA.toolsdatabase.dbo.remotetest3 100[/code]Works fine. Now enable Show Actual Execution Plan and rerun the above. I get this error:Msg 8114, Level 16, State 1, Line 1Error converting data type nvarchar(max) to int.If you run just the execute above I get this:(67 row(s) affected)(1 row(s) affected)That second rows affected part is odd. If you run this:[code="sql"]execute serverA.toolsdatabase.dbo.remotetest3 100with result sets ((Object_id int not null))[/code]I get 67 rows of output and then this message:Msg 11535, Level 16, State 1, Line 1EXECUTE statement failed because its WITH RESULT SETS clause specified 1 result set(s), and the statement tried to send more result sets than this.Clearly the act of getting the actual execution plan is breaking a simple linked server remote execution INSERT mytable EXEC myremotesproc. Can others verify this? I don't have access to lower builds of SQL Server at the moment. Wonder if this has always been the case?Oh, one more oddity while I am at it. This:[code="sql"]insert #tmpexecute ServerA.toolsdatabase.dbo.remotetest3 100with result sets ((Object_id int not null));[/code]gets me this error:Msg 102, Level 15, State 1, Line 3Incorrect syntax near 'SETS'.But it works fine if you aren't trying to do the insert!!
↧