SSIS 2008 and StreamWriter

  • I have a chunk of C# code that exports data from several tables in a SQL 2008 R2 DB into a single standardized flat file using StreamWriter. (Data from disparate sources is normalized into this DB then it's exported into a standard file layout.) This code runs super fast as part of a compiled C# app. It runs super slow when I run the same code in a script task as part of an SSIS 2008 package. I think it’s the actual writing of the data to the text files. If I comment out the sw.WriteLine(strLine) lines of code, it runs OK. I've attached a file containing my program code if additional information is needed.

    What do I need to do differently here to make this run faster? Use something other than StreamWriter in an SSIS package? Oh, and I’m new to both C# and SSIS but not to programming.

  • Is there another task running at the same time?

    Russel Loski, MCSE Business Intelligence, Data Platform

  • The task creating the output file using StreamWriter is the last task in a series of tasks being executed in a ForEach Loop container. There are no other script tasks running at the time my troublesome one is executing though.

  • Well... no one really chimed in with anything to help me out here.

    I did perform several tests in which I ran the SSIS package a variety of different ways: directly from within BIDS, using the Execute Package Utility (DTExecUI.exe) and calling the package directly from DTExec.exe on the command line and in every case it took over a minute to run the package. Straight C# doing the exact same thing took about 10 seconds. (I know those numbers sound low, but I'm just testing here. I expect to process a large volume of files through here in production.)

    So... uncle... I may just build my app in C#...

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply