SSIS包创建.csv文件,添加列但不添加行

SSIS包创建.csv文件,添加列但不添加行,csv,visual-studio-2015,ssis,Csv,Visual Studio 2015,Ssis,因此,我可以在OLEDB源代码中测试连接,并将其连接起来 我可以在OLE DB源代码编辑器中预览存储过程 OLE DB源代码编辑器中的错误输出窗口将错误和截断设置为“Fail Component”(我也尝试了其他选择) 将创建.csv文件并添加列标题名称 但是没有数据行 编辑。有人提到我应该包括存储过程。这对于测试目的来说非常简单。我确实将“从tblReport选择*替换为” “从tblReport中选择RPT_ID、RPT_名称、RPT_描述、RPT_数据库时间戳、RPT_活动、RPT_插入日

因此,我可以在OLEDB源代码中测试连接,并将其连接起来

我可以在OLE DB源代码编辑器中预览存储过程

OLE DB源代码编辑器中的错误输出窗口将错误和截断设置为“Fail Component”(我也尝试了其他选择)

将创建.csv文件并添加列标题名称

但是没有数据行

编辑。有人提到我应该包括存储过程。这对于测试目的来说非常简单。我确实将“从tblReport选择*替换为” “从tblReport中选择RPT_ID、RPT_名称、RPT_描述、RPT_数据库时间戳、RPT_活动、RPT_插入日期、RPT_注释”。我删除了所有未使用的列

这是我在调试模式下运行时输出窗口中的新文本。它仍然是一样的,输出列是我希望在Excel文件中看到的列,但输出窗口对所有列都显示“未随后使用”

SSIS package "C:\Mail_Merge\ExportToExcel_2\Package.dtsx" starting.
Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase is beginning.
Warning: 0x80208385 at Data Flow Task, OLE DB Source [23]: No rows will be sent to error output(s). Configure error or truncation dispositions to redirect rows to the error output(s), or delete data flow transformations or destinations that are attached to the error output(s).
Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase is beginning.
Warning: 0x80208385 at Data Flow Task, OLE DB Source [23]: No rows will be sent to error output(s). Configure error or truncation dispositions to redirect rows to the error output(s), or delete data flow transformations or destinations that are attached to the error output(s).
Warning: 0x80047076 at Data Flow Task, SSIS.Pipeline: The output column "RPT_ID" (35) on output "OLE DB Source Output" (34) and component "OLE DB Source" (23) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
Warning: 0x80047076 at Data Flow Task, SSIS.Pipeline: The output column "RPT_Name" (36) on output "OLE DB Source Output" (34) and component "OLE DB Source" (23) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
Warning: 0x80047076 at Data Flow Task, SSIS.Pipeline: The output column "RPT_Description" (37) on output "OLE DB Source Output" (34) and component "OLE DB Source" (23) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
Warning: 0x80047076 at Data Flow Task, SSIS.Pipeline: The output column "RPT_DBTimestamp" (38) on output "OLE DB Source Output" (34) and component "OLE DB Source" (23) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
Warning: 0x80047076 at Data Flow Task, SSIS.Pipeline: The output column "RPT_Active" (39) on output "OLE DB Source Output" (34) and component "OLE DB Source" (23) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
Warning: 0x80047076 at Data Flow Task, SSIS.Pipeline: The output column "RPT_INSDate" (40) on output "OLE DB Source Output" (34) and component "OLE DB Source" (23) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
Warning: 0x80047076 at Data Flow Task, SSIS.Pipeline: The output column "RPT_Note" (41) on output "OLE DB Source Output" (34) and component "OLE DB Source" (23) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
Information: 0x40043006 at Data Flow Task, SSIS.Pipeline: Prepare for Execute phase is beginning.
Information: 0x40043007 at Data Flow Task, SSIS.Pipeline: Pre-Execute phase is beginning.
Information: 0x402090DC at Data Flow Task, Flat File Destination [2]: The processing of file "C:\SSIS\testSSIS.csv" has started.
Information: 0x4004300C at Data Flow Task, SSIS.Pipeline: Execute phase is beginning.
Information: 0x40043008 at Data Flow Task, SSIS.Pipeline: Post Execute phase is beginning.
Information: 0x402090DD at Data Flow Task, Flat File Destination [2]: The processing of file "C:\SSIS\testSSIS.csv" has ended.
Information: 0x4004300B at Data Flow Task, SSIS.Pipeline: "Flat File Destination" wrote 0 rows.
Information: 0x40043009 at Data Flow Task, SSIS.Pipeline: Cleanup phase is beginning.
SSIS package "C:\Mail_Merge\ExportToExcel_2\Package.dtsx" finished: Success.
另一个编辑:带有感叹号的控制流的屏幕打印。 将鼠标悬停在它显示的感叹号上: “不会将任何行发送到错误输出。请配置错误或截断处理以重定向行。”嗯


无论是否提供行,都将始终创建目标文件(无论是否出错)


如果需要根据发送到目标的行获取逻辑,则需要创建SSIS变量并将其附加到行计数转换。完成数据流任务后,需要根据计数采取操作。有些人选择只使用脚本任务来检查文件,但我发现在检查时只记录计数而不是事后检查是更好的做法。

确保进入目标的数据流是成功数据流,而不是失败数据流。从您的屏幕截图中可以看出,只有故障数据流被映射通过

发布存储过程有帮助,但不管怎样。。。存储过程可能会产生令人困惑的结果,请确保它始终准确地返回onerecordset,它始终具有相同的元数据,并且您已经启用了
SET NOCOUNT在顶部。查看日志。。。。是否已将SP结果中的列映射到CSV文件?日志中提到的列是否被故意排除在外?由于Error和Truncation设置为“Redirect row”,您需要将这些重定向的行放到某个地方。出于调试的考虑,我建议您选择“fail component”,因为这将产生一个错误,您可以使用它来进行故障诊断。我已经包含了我非常简单的存储过程。它没有在顶部设置计数。我将列映射到CSV文件中。日志中提到的列实际上就是我正在使用的列。我已将“重定向行”更改为“失败组件”。但是仍然不走运。@Nick,请给出您的评论“查看您的上一个屏幕截图,您没有将绿色数据流(成功输出)映射到任何内容”,我会接受它。很公平,非常感谢。现在我知道绿色箭头和红色箭头的用途了。(为我辩护,我电脑上的绿色箭头是深灰色的。哈哈)谢谢你留下来尝试不同的东西。