如何在 SSIS 中删除 Excel 行?

发布于 2024-07-08 04:55:30 字数 35 浏览 7 评论 0原文

是否可以从 SSIS 中删除 Excel 工作表中的行?

Is it possible to delete rows in an excel worksheet from SSIS?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

没有你我更好 2024-07-15 04:55:30

论坛

  1. 在控制流中创建文件系统任务,删除文件。
  2. 创建一个sql任务,excel连接类型,我为此使用了以前的excel连接,然后使用创建表脚本作为我的sql语句
  3. 使我以前的导出对象保持不变,然后按描述的顺序链接这些流程。

From forum

  1. create a file system task in control flow, deleting the file.
  2. create a sql task, excel connection type, i used my previous excel connection for this, then used a create table script as my sql statement
  3. left my previous export object the same, then linked the flow of these in this order described.
琉璃梦幻 2024-07-15 04:55:30

微软的 arctile 声称您无法删除整行,但可以删除单元格中的值。 http://support.microsoft.com/kb/257819

此帖子涉及以下人员:同样的问题:
http:// www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.adonet/2006-12/msg00245.html

简而言之,答案似乎是“不”,您不能删除整行通过 SSIS 使用 ado.net。 您可以使用 Excel 自动化或 Excel 本身中的 vb.net 来完成此任务。

An arctile by microsoft claims that you cannot delete an entire row however you can delete a value in a cell. http://support.microsoft.com/kb/257819

This thread relates to someone with the same problem:
http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.adonet/2006-12/msg00245.html

In short, it seems like the answer is 'no', you cannot delete an entire row using ado.net via SSIS. You may be able to use excel automation or vb.net in excel itself to accomplish this task.

2024-07-15 04:55:30

我还按照 Gulzar 建议的步骤完成了此操作,但是,如果有人想要详细信息,这就是我所做的:

我最初的任务是从 SQL Server 读取一些信息并将其导出到 Excel:

在此处输入图像描述

然后,我添加了建议的任务,一项用于删除目标 Excel 文件,一项用于重新创建它:

在此处输入图像描述

这是删除文件的任务,它是一个“文件系统任务”:

在此处输入图像描述

这是重新创建 Excel 文件的任务,它是一个“执行 SQL 任务”:

在此处输入图像描述

需要为此“执行 SQL 任务”设置以下内容

: 连接类型为“Excel”

b. 根据建议,该连接与原始导出任务 c 使用的连接相同

。 SQL 语句是从原始导出任务复制的

基本上就是这样。 运行它,它应该可以工作。 我与 SQL Server 的连接如下所示:

在此处输入图像描述

我的 Excel 连接最初是在创建导出任务时创建的,如下所示:

在此处输入图像描述

在“数据流”中部分,使用源助手,原始的“OLE DB源”有这样的:

在此处输入图像描述

并且,使用目标助手,原始 Excel 目标具有以下内容:

在此处输入图像描述

这是我从原始 Excel 目标复制的 SQL 语句:

在此处输入图像描述

I also did it by following the steps suggested by Gulzar but, in case anyone wants the details, this is what I did:

I originally had a task to read some information from SQL Server and export it to Excel:

enter image description here

I then added the suggested tasks, one to delete the destination Excel file and one to recreate it:

enter image description here

This is the task to delete the file, it's a "File System Task":

enter image description here

This is the task to re-create the Excel file, it's an "Execute SQL Task":

enter image description here

The following needs to be set for this "Execute SQL Task":

a. Connection Type is "Excel"

b. As suggested, the connection is the same one used by the original Export task

c. The SQL statement was copied from the original Export task

That's basically it. Run it and it should work. My connection to SQL Server looks like this:

enter image description here

My Excel connection, which was originally created when the Export task was created, looks like this:

enter image description here

In the "Data Flow" section, using the Source Assistant, the original "OLE DB Source" has this:

enter image description here

And, using the Destination Assistant, the original Excel Destination has this:

enter image description here

This is the SQL Statement that I copied from the original Excel Destination:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文