将数据从报告数据库传输到另一个数据库的最佳工具是什么?
我有一个报告数据库,必须将数据从该数据库传输到另一台服务器,我们在该服务器上运行一些其他报告或数据功能。定期(例如每月或每周)传输数据的最佳方式是什么?我可以使用 SSIS,但是我是否可以在应该从源数据库中提取哪些行上放置一些 where 子句?就像我只想提取当月的数据。请告诉我。
谢谢, 维韦克
I have a reporting database and have to transfer data from that to another server where we run some other reports or functions on Data. What is the best way to transfer data periodically like months or by-weekly. I can use SSIS but is there anyway I can put some where clause on what rows should be extracted from the source database? like i only want to extract data for a current month. Please do let me know.
Thanks,
Vivek
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于安排定期提取,我将留给 SQL 代理。
至于用某种条件来限制结果,那是很容易的事情。相反(您应该始终使用 SQL 命令或来自变量的 SQL 命令而不是表名称/来自变量的表名称,因为它们更快)
添加参数。如果您使用 OLE DB 连接管理器,则变量指示符为
?
。 ADO.NET 将为@parameterName
现在,通过单击连接过滤器参数...按钮。对于 OLE DB,它的序数位置从 0 开始。如果您想使用同一参数两次,则必须每次都列出它或使用 ADO.NET 连接管理器。
您必须回答的最大问题是如何确定需要删除哪些行。可能性是无限的:查询目标数据库并查找表的最新修改日期或最高键值。您可以创建一个本地表来跟踪已发送的内容并进行查询。您可以执行 增量加载 / ETL 工具来识别新的/更新的/未更改的行等。
For scheduling periodic extractions, I'd leave to that SQL Agent.
As for restricting the results by some condition, that's an easy thing. Instead of this (and you should always use SQL Command or SQL Command From Variable over Table Name/Table Name From Variable as they are faster)
Add a parameter. If you're use OLE DB connection manager, your indicator for a variable is
?
. ADO.NET will be@parameterName
Now, wire the filter up by clicking the Parameters... button. With OLE DB, it's ordinal position starting at 0. If you wanted to use the same parameter twice, you will have to list it each time or use the ADO.NET connection manager.
The biggest question you will have to answer is how do I identify what row(s) need to go. Possibilities are endless: query into the target database and find most recent modified date for a table or highest key value. You could create a local table that tracks what's been sent and query that. You could perform an incremental load / ETL Instrumentation to identify new/updated/unchanged rows, etc.