官术网_书友最值得收藏!

How to do it...

  1. In SSDT, with your project open, right-click on the Control Flow folder in the Package Parts section of the solution explorer. As shown in the following screenshot, select New Control Flow Package Part from the contextual menu. Rename it Chapter2Part.dtsxp.
  1. Drag and drop an Execute SQL task on it:
    1. Rename it sql_Truncate_dbo_CustomLogging.
    2. Click anywhere in the Control Flow. Set its description property to This is a simple template that is meant to truncate the table [dbo].[CustomLogging].
    3. As shown in the following screenshot, right-click in the Connection Managers area and choose New OLE DB Connection... from the menu that appears:
  1. As shown in the following screenshot, select the existing connection (SSISCOOKBOOK\TestCustomLogging in this case) in the top left or create a new one by clicking on NEW.... Click on OK when done to close the Configure OLE DB Connection Manager window.
  1. Double-click on the sql_Truncate_dbo_CustomLogging task to open the Execute SQL Task Editor. Set the properties in the SQL Statement section as follow:
    • ConnectionType: OLE DB, the default value
    • Connection: Set it to the connection manager created in the previous step.
    • SQLSourceType: Leave the default value, Direct input type the following SQL DML statement in the SQL Statement property:
    TRUNCATE TABLE [dbo].[CustomLogging];

It is also shown in the following screenshot:

  1. Save and close the Chapter2Part.dtsxp package part.
  2. Now, open the CustomLogging package from the solution explorer. As shown in the following screenshot, there is now a new component in the Package Parts section of the SSIS Toolbox: the Chapter2Part created in the previous steps. Also, notice the description below the Package Parts section. This is the one that we assigned at the Control Flow level of the package part when it was created.
  1. Drag and drop a Chapter2Part onto the Control Flow of the CustomLogging package. Now to get the same as in the following screenshot:

Execute the following steps:

  1. Connect it to the dft_dbo_CustomLogging data flow task.
  2. Select all Control Flow components
  3. In the Layout toolbar, click Make Same Size
  4. From the Format menu, select Auto Layout Diagram to properly align the tasks
  5. Execute the package to make sure that the package part is properly working and stop the package execution when done.
  6. Double-click on the Chapter2Part to view its properties as shown in the following screenshot. Go to the Connection Managers tab. Locate the ConnectionString property as highlighted in the screenshot. Notice that it has a fixed value. This is the biggest limitation of these parts; there is no way for now to alter any of the property at runtime. We cannot use package configurations or parameters to alter these values dynamically as we can with regular tasks.
主站蜘蛛池模板: 阜平县| 财经| 南乐县| 海安县| 金堂县| 三原县| 博乐市| 贵溪市| 开江县| 青铜峡市| 石渠县| 九龙坡区| 广河县| 新源县| 镇安县| 无极县| 奇台县| 南溪县| 广德县| 绥中县| 黔东| 会宁县| 衢州市| 珲春市| 大连市| 南部县| 平乐县| 习水县| 个旧市| 平武县| 松溪县| 秦皇岛市| 喀喇| 鹤山市| 溧阳市| 贡山| 旺苍县| 馆陶县| 安阳县| 渭南市| 南丹县|