简体   繁体   English

具有并发执行的SQL Server同义词

[英]SQL Server synonyms with concurrent execution

I work in a DW project where we do ETL using T-SQL with SQL Server 2012. Our code works well so far for a set of tables coming from a legacy system. 我在一个DW项目中工作,在该项目中我们使用带有SQL Server 2012的T-SQL进行ETL。到目前为止,我们的代码对于一组来自旧系统的表都运行良好。 However, the Data Architect has announced we will receive tables from other legacy systems. 但是,数据架构师已经宣布,我们将从其他旧系统中接收表格。 He wants the same piece of code to be able to handle all the tables of all the systems since they will have the same structure but exist in separate DBs in the same server. 他希望同一段代码能够处理所有系统的所有表,因为它们将具有相同的结构,但是存在于同一服务器的单独DB中。

On top of that, he requires the existing piece of code to run at the same time for all of the system's tables so we save execution time. 最重要的是,他要求现有的代码段可以在所有系统表中同时运行,因此我们节省了执行时间。 I have been working on a POC using synonyms which seems to do the trick but it won't execute our code for different set of tables at the same time because we will end up overwriting the references of the synonym objects currently being executed. 我一直在使用同义词进行POC,这似乎可以解决问题,但是它不会同时针对不同的表集执行代码,因为我们最终将覆盖当前正在执行的同义词对象的引用。 So I am now rethinking the whole problem: How to avoid rewriting the same code we have for each set of tables we get while at the same time allowing concurrent execution? 因此,我现在在重新思考整个问题:如何避免为同时获得并发执行的每组表重写相同的代码? Any insight or suggestion will be appreciated. 任何见解或建议将不胜感激。 Thanks. 谢谢。

I would look at using SSIS to do your ETL. 我会考虑使用SSIS进行ETL。 You can change the location of the source data at run time and as long as the structure is the same it should work. 您可以在运行时更改源数据的位置,只要结构相同即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM