代码之家  ›  专栏  ›  技术社区  ›  JustJohn

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

  •  1
  • JustJohn  · 技术社区  · 6 年前

    因此,我可以在OLE DB源代码中测试连接,并进行连接。

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

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

    这个创建csv文件并添加列标题名称。

    但没有数据行。

    编辑有人提到我应该包括存储过程。这对于测试目的来说非常简单。我确实将“从tblReport选择*”替换为 “从tblReport中选择RPT\u ID、RPT\u Name、RPT\u Description、RPT\u DBTimestamp、RPT\u Active、RPT\u INSDate、RPT\u Note”。我删除了所有未使用的列。

    这是我在调试模式下运行时输出窗口中的新文本。它仍然是一样的,输出列是我希望在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.
    

    另一个编辑:带有感叹号的控制流的屏幕打印。 将鼠标悬停在它显示的感叹号上: “不会将任何行发送到错误输出。请配置错误或截断处理以重定向行。”嗯?

    enter image description here

    2 回复  |  直到 6 年前
        1
  •  1
  •   Nick.Mc    6 年前

    确保引入目标的数据流是成功数据流,而不是失败数据流。从您的屏幕截图来看,似乎只有故障数据流被映射通过。

        2
  •  0
  •   billinkc    6 年前

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

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