English 中文(简体)
与 CRLF 或 LF 一同读取 SISIS 的文本文件
原标题:Reading a text file with SSIS with CRLF or LF
  • 时间:2012-05-24 15:27:44
  •  标签:
  • sql
  • ssis

正在处理一个问题, 我收到一个文本文件, 它以LFs作为 EOL。 有时他们发送文件, 以CRLFs作为 EOL 。 有人知道我如何让 SSIS 使用其中之一作为 EOL 吗?

这是一个非常容易的转换操作, 带有notepad+++ 来将其转换为我所需要的, 但是,它只是手动操作, 我希望它自动。

谢谢

EDIT。 我在数据流之前使用 < a href="http://sourceforge.net/projects/swisfilesfilesknife/ >Swis File Knife 来修补(但不完美)它。

最佳回答

我赞成执行部分第2段对瑞士刀子案的投票。

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

然而,我有一大堆包裹 运行“每件每件每件每件每件每件每件每件每件每件每件每件每件每件的环路”, 所以我需要一些BIML—— 也许这能帮助下一位灵魂。

<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”行分隔器连接。

然后, 创建一个布林包变量( 类似@ IsCrLf), 并将它覆盖到您的包中。 在您的 SIS 套件中, 第一步为 < a href=" http:// msdn. microsoft. com/ en- us/ library/ ms141752. aspx" rel= " noreferrer" > Script task , 您在文件中读到, 并尝试找出线终止者( 根据您在流中找到的东西) 。 按此设置变量的值 。

然后,在您控制流程中的脚本任务之后,创建两个独立的数据流(每个文件连接管理器一个),并使用 < a href="http://msdn.microsoft.com/en-us/library/ms141261.aspx" rel=“noreferr” > Presenteence constraint 设置为连接器“Expression and constrainint”以指定要使用的数据流,取决于@ISCrLf 变量的值。

建议的以下控制流动实例。

"https://i.sstatic.net/A6D1d.png" alt="例如SSIS控制流程"/ >

在您的文件源之后, 将 CRLF 转换为 LF 的 REPLACE 操作的导出列如何?





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

难以执行 REGEXP_SUBSTR

I m 查询Oracle 10g。 我有两张表格(样本数据见下文)。 i m 试图提取一些领域

SQL Query Shortcuts

What are some cool SQL shorthands that you know of? For example, something I learned today is you can specify to group by an index: SELECT col1, col2 FROM table GROUP BY 2 This will group by col2

PHP array callback functions for cleaning output

I have an array of output from a database. I am wondering what the cleanest way to filter the values is example array Array ( [0] => Array ( [title] => title 1 ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

Running numbers in SQL

I have a SQL-statement like this: SELECT name FROM users WHERE deleted = 0; How can i create a result set with a running number in the first row? So the result would look like this: 1 Name_1 2 ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签