简体   繁体   中英

Passing large string to Pipelinebuffer (C# and SSIS)

I'm trying to load a large string (over 8000 characters) into a SQL Server database. (from a file)

I'm using PipelineBuffer to add a row and populate the output.

Using a script would return an error saying that it can't process more than 8000 character per field.

Using Text streamer will prevent me from adding a row as it convert the Text streamer to a blob component and it is marked as read only.

My work around was to alter the BufferWarpper.cs and load my data. Is there anyway to load the data without altering the BufferWarpper.cs (as it this script is generated automatically do not alter)

Blob columns have a method called AddBlobData() for setting the value. In the example below, Column1 is NText data type:

public override void CreateNewOutputRows()
    {
        using (var sr = new StreamReader(@"<path to file>"))
        {
            string line;
            while ((line = sr.ReadLine()) != null)
            {
                string[] columns = line.Split(',');
                Output0Buffer.AddRow();
                Output0Buffer.Column1.AddBlobData(Encoding.Unicode.GetBytes(columns[0]));
            }
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM