将存储过程转换为 SSIS 包 [英] Converting Stored Procedures to SSIS packages

查看:26
本文介绍了将存储过程转换为 SSIS 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要将 SP 列表转换为 SSIS 包.大多数 SP 执行以下步骤:

We require to convert a list of SPs to SSIS packages. Most of the SPs do the below steps:

  1. 创建一个表并使用SELECT INTO"语句将数据插入其中,该语句有许多连接.
  2. 更新表 - 这也有很多连接.
  3. 在创建的表上创建索引.

我们应该在这里使用什么方法?由于 SP 中没有 ETL,我们将每组语句转换为一个 Execute SQL 任务.这是正确的方法吗?
我们可以做些什么来提高包的性能?
有些 SP 使用不同的参数多次调用另一个 SP(这些参数在 SP 中是硬编码的).哪个 SSIS 任务适合这里?我尝试使用 ExecuteSQL taskRetainSameConnection true.

What approach should we use here? Since there is no ETL in the SP, we converted each set of statements to one Execute SQL task. Is this the right approach?
What we can do to improve the performance of the packages?
There are SPs that call another SP many times with different parameters(The parameters are hard-coded in the SP). Which SSIS task would be suitable here? I tried using ExecuteSQL task with RetainSameConnection true.

推荐答案

我们将每组语句转换为一个执行 SQL"任务.这是正确的方法吗?

We converted each set of statements to one ‘Execute SQL’ task. Is this the right approach?

不,鉴于您的声明长过程不容易管理.此外,希望通过在 SSIS 包的上下文中调用存储过程来提高性能",您所做的只是增加了一层开销为您的来电.

No, given your statement of "the long procedures are not easy to manage. Also, wanted to improve the performance" by calling the stored procedures within the context of an SSIS package, all you have accomplished is adding a layer of overhead for your calls.

你如何让它变得更好?这将在很大程度上取决于什么你在做什么.您的一般方法可能看起来像

How do you make it better? That's going to depend greatly on what you are doing. You general approach will probably look like

  1. 创建源和目标 OLE DB 连接管理器
  2. 创建一个变量,字符串类型并使用它来存储正在创建的表的名称
  3. 执行 SQL 任务 - 这实际上会创建您的目标表.我想我读过一个显式的表声明比用 INTO 语句创建一个更有效
  4. 将数据流任务连接到该执行 SQL 任务.使用 OLE DB 源并将源类型从表更改为查询和调用您的存储过程.这可能需要修改以不创建目标表.将一个 OLE DB 目标拖放到画布上,并将目标从变量快速加载(名称近似)更改为表或视图,然后选择上面创建的变量.
  5. 更新可能最好留给现有逻辑.只需将其放在执行 sql 任务中
  6. 此索引创建也将成为执行 SQL 任务.

所有这些连接仍然进展缓慢?那可能是一个调整操作.我们需要查看表结构、查询和估计的查询计划.

Things still going slow with all these joins? That'll probably be a tuning operation. We'd need to see table structures, the queries and the estimated query plan.

这篇关于将存储过程转换为 SSIS 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆