Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SSIS Package - exporting text file - Visual Studio

Posted on 2014-01-16
7
Medium Priority
?
325 Views
Last Modified: 2016-02-10
Hello experts,

I have Microsoft Visual Studio 2012 with SSIS tools installed, and I currently have a package that is harvesting data from a few tables in the database via SQL script, but ultimately compiling and outputting in CSV format to a text file with headers.

Looks something like this in the output:

person_id            file_id               location_id
12345                  NG1234           1234567890
12345                  NG1235           1234567891
12346                  NG1236           1234567892
12346                  NG1237           1234567893

That works just fine but I recently received a request to have a 1-time bit of text at the top before the CSV file data floods in, mostly header information.  I would like to find a way to have the file out put be:

user:testuser
password:uf43ufn4u
api_id:34593434
text:Hello #field1#, your account balance is now #field2# as of 12:00AM today.
delimiter:|
person_id            file_id               location_id
12345                  NG1234           1234567890
12345                  NG1235           1234567891
12346                  NG1236           1234567892
12346                  NG1237           1234567893

The chunk of text at the top, right before the CSV person_id text starts, would be static and never changing believe it or not.

Thoughts?

Thanks!
0
Comment
Question by:robthomas09
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
7 Comments
 
LVL 16

Expert Comment

by:Surendra Nath
ID: 39786928
There are many ways to do this

1) after the data flow task at the end of your package, put a script compoenent.
And in the script by using the .NET runtime open the file and add the text to the start of it -- pretty easy task -- but not appealing to tech geeks.
0
 

Author Comment

by:robthomas09
ID: 39787335
Thanks for the reply!

Not being the strongest at .NET, I will do some research and give that a try for sure.  I did see that you mentioned "There are many ways to do this" - any chance on elaborating on a few of the others in case I might be stronger-suited in in one of those manners?

Thanks again!
0
 

Author Comment

by:robthomas09
ID: 39790263
No luck any other ideas?
0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 

Author Comment

by:robthomas09
ID: 39791740
Something like:


    public override void PostExecute()
    {
        base.PostExecute();
        System.IO.StreamWriter tw
        = System.IO.File.AppendText(@"C:\Test.txt");

            tw.WriteLine("Text at the top of the file");
       
        base.ProcessInput(InputID, Buffer);
        tw.Close();
    }

    public override void CreateNewOutputRows()
    {

    }

}
0
 

Accepted Solution

by:
robthomas09 earned 0 total points
ID: 39794799
Poor follow up
0
 

Author Closing Comment

by:robthomas09
ID: 39845106
paid someone to fix this for me, with .NET skills
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question