A number of years ago, I implemented a remote query solution in SQL 2008 based off the remote execution code by Rudy Panigas shown at the link below.[URL]http://www.sqlservercentral.com/scripts/Replication/31819/[/URL]This solution worked very well to help us remotely execute queries against 200+ SQL servers across 130 Active Directory forests or stand-alone workgroups. I am now looking to bring this solution forward to SQL 2012. When the script runs and tries to dynamically create a linked server connection, I get the following error message.[code="other"]The procedure 'sys.sp_addlinkedserver' cannot be executed within a transaction.[/code]In diving into the problem, I have confirmed that the while loop used to cycle through the cursor is the culprit. Does anyone know what changed between SQL 2008 and SQL 2012 that caused this to break? Does anyone know of any workarounds to allow this code to work again?
↧