SSIS列数从一个平面文件 [英] SSIS column count from a flat file

查看:141
本文介绍了SSIS列数从一个平面文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一种方法来统计来自平面文件的列。实际上,我的所有列都被连接在一个单元格中,经过各种尝试后,用|和
作为单元格,似乎只有一个脚本任务可以处理这个。
有人可以帮我吗?我很可惜没有使用C#或VB脚本的经验。
$ b $ p感谢很多
Emmanuel



为了更好地理解,下面是我想达到的结果。例如包含来自FF的所有报头的单个单元。问题是,为了得到这个结果,我在前面的步骤(派生列)中手动添加了所有列名,以便将它们与|分隔符连接起来。
现在,如果我的FF源代码布局发生变化,由于这个手动过程,它将不再工作。所以我想我将不得不使用一个脚本,而是基本上返回我的数量的列(标题)在一个变量,并将允许删除派生列transfo硬编码的部分,例如

Stack Overflow 问题中参考我的答案。这些答案可能会让您了解如何加载包含不同列数的平面文件。
$ b


  1. 以下问题中的示例将读取包含以特殊字符 Ç C-加符) 即可。在你的情况下,分隔符是竖线(|)
    UTF-8平面文件导入到SQL Server 2008不识别{LF}行分隔符<在下面的问题中的示例读取一个EDI文件,其中包含具有不同列数的不同部分。包读取文件将其相应的父子关系加载到SQL表中。
    如何将带有标题和详细信息父子关系的平面文件加载到SQL服务器中


  2. b
    $ b

    根据这些答案中使用的逻辑,还可以通过分隔列定界符(Vertical Bar |)



    希望有帮助。


    I'm trying to find a way to count my columns coming from a Flat File. Actually, all my columns are concatened in a signe cell, sepatared with a '|' ,
    after various attempts, it seems that only a script task can handle this. Does anyone can help me upon that ? I've shamely no experience with script in C# ou VB.

    Thanks a lot Emmanuel

    To better understand, below is the output of what I want to achieve to. e.g a single cell containing all headers coming from a FF. The thing is, to get to this result, I appended manually in the previous step ( derived column) all column names each others in order to concatenate them with a '|' separator. Now , if my FF source layout changes, it won't work anymore, because of this manualy process. So I think I would have to use a script instead which basically returns my number of columns (header ) in a variable and will allow to remove the hard coded part in the derived column transfo for instance

    解决方案

    Please refer my answers in the following Stack Overflow questions. Those answers might give you an idea of how to load a flat file that contains varying number of columns.

    1. Example in the following question reads a file containing data separated by special character Ç (c-cedilla). In your case, the delimiter is Vertical Bar (|) UTF-8 flat file import to SQL Server 2008 not recognizing {LF} row delimiter

    2. Example in the following question reads an EDI file that contains different sections with varying number of columns. The package reads the file loads it accordingly with parent-child relationships into an SQL table. how to load a flat file with header and detail parent child relationship into SQL server

    Based on the logic used in those answers, you can also count the number of columns by splitting the rows in the file by the column delimiter (Vertical Bar |).

    Hope that helps.

    这篇关于SSIS列数从一个平面文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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