使用带有 CRLF 或 LF 的 SSIS 读取文本文件 [英] Reading a text file with SSIS with CRLF or LF

查看:33
本文介绍了使用带有 CRLF 或 LF 的 SSIS 读取文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

遇到一个问题,我收到一个文本文件,该文件的 EOL 为 LF.有时他们发送带有 CRLF 的文件作为 EOL.有没有人对如何让 SSIS 使用其中任何一个作为 EOL 有什么好主意?

使用 notepad++ 将其更改为我需要的任何内容是一个非常简单的转换操作,但是,它是手动的,我希望它是自动的.

谢谢,

编辑.我在数据流之前使用

然而,我有一堆运行 For-Each-File 循环的包,所以我需要一些 BIML - 也许这会帮助下一个灵魂.

<ExecuteProcess Name="(EXE) Convert crlf for <#= tableName #>"Executable="<#= myExeFolder #>sfk.exe"><表达式><Expression PropertyName="参数">"crlf-to-lf" + @[User::sFullFilePath]</表达式></表达式></ExecuteProcess>

Running into an issue where I receive a text file that has LF's as the EOL. Sometimes they send the file with CRLF's as the EOL. Does anyone have any good ideas on how I can make SSIS use either one as the EOL?

It's a very easy convert operation with notepad++ to change it to what ever I need, however, it's manual and I want it to be automatic.

Thanks,

EDIT. I fixed it (but not perfect) by using Swiss File Knife before the dataflow.

解决方案

I second the OP's vote for Swiss File Knife.

To integrate that, I had to add an Execute Process Task:

However, I have a bunch of packages that run For-Each-File loops, so I needed some BIML - maybe this'll help the next soul.

<ExecuteProcess Name="(EXE) Convert crlf for <#= tableName #>"
              Executable="<#= myExeFolder #>sfk.exe">
  <Expressions>
    <Expression PropertyName="Arguments">
      "crlf-to-lf " +  @[User::sFullFilePath]
    </Expression>
  </Expressions>
</ExecuteProcess>

这篇关于使用带有 CRLF 或 LF 的 SSIS 读取文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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