Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
取代&引用;在SSIS中使用逗号(,)_Ssis_Double_Quotes_Derived - Fatal编程技术网

取代&引用;在SSIS中使用逗号(,)

取代&引用;在SSIS中使用逗号(,),ssis,double,quotes,derived,Ssis,Double,Quotes,Derived,我试图导入一个文本文件,其中制表符分隔,文本限定符是双引号。 我遵循以下指南: 我想要下面的文字 "655295" "Keisuke" "" "Ueda" "1-2-2, Central Park East F201" "Utase, Mihama-Ku" 皈依 "655295","Keisuke","","Ueda","1-2-2, Central Park East F201","Utase, Mihama-Ku" 我尝试了派生列转换,但没有帮助。我尝试了脚本组件,但也不起作用。有人能

我试图导入一个文本文件,其中制表符分隔,文本限定符是双引号。 我遵循以下指南:

我想要下面的文字

"655295" "Keisuke" "" "Ueda" "1-2-2, Central Park East F201" "Utase, Mihama-Ku"
皈依

"655295","Keisuke","","Ueda","1-2-2, Central Park East F201","Utase, Mihama-Ku"
我尝试了派生列转换,但没有帮助。我尝试了脚本组件,但也不起作用。有人能帮帮我吗


提前谢谢你

我在脚本组件中使用了以下代码:

public override void Input0_ProcessInputRow(Input0Buffer Row)
    {
        /*
         * Add your code here
         */
        String inputString = Row.line.ToString();

        int count = Row.line.Split('"').Length - 1;
        int counter = 1;

        while (counter < count)
        {
            if (counter % 2 == 0)
            {
                int StartIndex = GetNthIndex(inputString.ToString(), Convert.ToChar("\""), counter);
                int EndIndex = GetNthIndex(inputString.ToString(), Convert.ToChar("\""), counter + 1);

                inputString = inputString.ToString().Substring(0, StartIndex + 1) + "," +
                inputString.ToString().Substring(EndIndex);

            }
            else
            {
            }
            counter = counter + 1;
        }
        Row.OutputLine = inputString;
    }
    int GetNthIndex(string s, char t, int n)
    {
        int count = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == t)
            {
                count++;
                if (count == n)
                {
                    return i;
                }
            }
        }
        return -1;
    }
public override void Input0\u ProcessInputRow(Input0Buffer行)
{
/*
*在这里添加您的代码
*/
String inputString=Row.line.ToString();
int count=Row.line.Split(“”).Length-1;
int计数器=1;
while(计数器<计数)
{
如果(计数器%2==0)
{
int StartIndex=GetNthIndex(inputString.ToString(),Convert.ToChar(“\”),计数器);
int EndIndex=GetNthIndex(inputString.ToString(),Convert.ToChar(“\”),计数器+1);
inputString=inputString.ToString().子字符串(0,StartIndex+1)+“+
inputString.ToString()子字符串(EndIndex);
}
其他的
{
}
计数器=计数器+1;
}
Row.OutputLine=输入字符串;
}
int GetNthIndex(字符串s、字符t、int n)
{
整数计数=0;
对于(int i=0;i
获取一个变量并将字符串存储在变量中

然后使用derieved列将字符串函数用作

REPLACE(@user:Variable1,"\" \"","\",\"")

这将解决您的问题…

您可以通过以下步骤实现:-

1) 在平面文件连接管理器中,请执行以下操作将其配置为每行仅获取一列- i、 不要放置任何“文本限定符” ii.行delimter={CR}{LF} iii.Modifey Column delimited={CR}并刷新metadeta,这样您将只看到一列。请给它一个特定的名称,我现在将它称为“Col”

2) 添加派生列转换并将表达式作为 “(DT\U STR,1001252)替换(列,“\”、“\”、“\”)”。您将在新列中获得以下所需输出-

"655295","Keisuke","","Ueda","1-2-2, Central Park East F201","Utase, Mihama-Ku"
您可以将此输出放在不同的平面文件中,并使用不同的DFT或包将该文件导入到表中,也可以添加脚本组件将其拆分为不同的列,以便可以使用相同的DFT将数据导入到表中