跳过行:将数据从SSIS导出到excel文件 [英] Skip rows: Export data from SSIS into excel file

查看:126
本文介绍了跳过行:将数据从SSIS导出到excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用SSIS将数据从SQL Server数据库导出到excel文件中.我希望从第6行插入数据,第5行具有标题.

I am trying to export data from a SQL server database into an excel file using SSIS. I want the data to get inserted from the 6th row and 5th row has headers.

通过编写SQL命令,可以在 Excel Destination Editor 中将标头名称映射到SQL表标头:

I am able map the header names, in Excel Destination Editor, to the SQL table headers, by writing the SQL command:

SELECT * FROM [Sheet1$A5:EC5]

但是,当我执行程序包时,数据将从第二行插入 如何从第六行开始插入?

But still, when I execute the package, the data gets inserted from the 2nd row How can I start the insertion from 6th row?

感谢您为解决此问题而提供的任何帮助.预先感谢!

Any help, to solve this, is appreciated. Thanks in advance!

推荐答案

将空白行添加到SSIS的OLE DB源中的数据集中.我假设您数据库中的列名为Header1,Header2和Header3.将此查询替换为OLE DB源查询:

Add the blank rows to the dataset in OLE DB source in SSIS. I assume that your columns in your database are named Header1, Header2 and Header3. Replace your OLE DB source query with this query:

 select ' ' as Header1, ' ' as Header2, ' ' as Header3
 UNION ALL
 select ' ', ' ', ' '
 UNION ALL
 select ' ', ' ', ' '
 UNION ALL
 select ' ', ' ', ' '
 UNION ALL
 select ' ', ' ', ' '
 select Header1, Header2, Header3 from Your_SQL_SERVER_Tabl

如果列属于其他类型,则可能需要将其转换为varchar.

You may need to cast your columns to varchar if they are of other types.

这篇关于跳过行:将数据从SSIS导出到excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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