如何覆盖 SSIS 中的 Excel 目标? [英] How to overwrite Excel destination in SSIS?

查看:31
本文介绍了如何覆盖 SSIS 中的 Excel 目标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个包来从两个 SQL Server 表中获取数据,并使用合并连接合并这些数据,然后将结果存储到 Excel 目标中.

I have created a package to fetch data from two SQL Server tables, and using merge join combined this data, then stored the result into an Excel destination.

第一次运行正常.第二次在Excel文件中存储重复数据.

The first time it works fine. The second time it stores repeated data in the Excel file.

如何覆盖 Excel 文件行?

How do I overwrite the Excel file rows?

推荐答案

是的,有可能!

解决办法如下:

首先转到您的 Excel 目标单击 Excel 工作表名称旁边的新建按钮,复制里面的 DML 查询.然后将执行 SQL 任务放入您的控制流并将其连接到包含 Excel 目标的数据流.将连接类型设置为 Excel,将连接设置为 Excel 目标的 Excel 连接管理器,转到 SQL 语句并键入:

First go to your Excel Destination Click to New Button next to Name of Excel Sheet, copy the DML query inside. Then put an Execute SQL Task into your Control Flow and connect it to your data flow that contains Excel destination. Set the Connection Type To Excel, Set the Connection to your Excel Destination's Excel Connection Manager, go to SQL Statement and type :

Drop TABLE `put the name of the sheet in the excel query you just copied`
Go

最后在它后面粘贴查询.

finally paste the query after it.

这就是解决问题所需要做的一切.

It is all you need to do to solve the problem.

您可以参考此链接以获取完整信息:http://dwhanalytics.wordpress.com/2011/04/07/ssis-dynamically-generate-excel-tablesheet/

You can refer to this link for a complete info: http://dwhanalytics.wordpress.com/2011/04/07/ssis-dynamically-generate-excel-tablesheet/

这篇关于如何覆盖 SSIS 中的 Excel 目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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