Hi,I've recently started a new job and have found cursors to exist pretty much everywhere. I'm trying to replace these to use set based T-SQl but I'm struggling to find a solution. We have mutliple servers which hold more than one database and each database holds the same schema, so something along the lines of:Server1.DatabaseA.dbo.TestTableServer1.DatabaseB.dbo.TestTableServer2.DatabaseA.dbo.TestTableServer2.DatabaseB.dbo.TestTableServer3.DatabaseA.dbo.TestTableServer3.DatabaseB.dbo.TestTableFor data retrieval, the curser will pull all the unique link and db names and then loop round them in dynamic sql as table names can be passed into dynmaic sql. I'm stuggling to find an alterative to this despite a lot of time spent so far on this, I'm currently looking at using a foreach loop container in SSIS, as far as I'm aware, the server and database name can be held in an object variable which is then native to SSIS so the contention issues in SQL should be reduced.Any advice on this is greatly appreciated.ThanksMatt
↧