0

I have a simple requirement to create a text file for every row of data using column 1 as the file name and column 2 as the content of the file.

I am new to SSIS and all the tutorials I have seen so far use data flow inside a foreach loop. For each row they retrieve data from database and write it to a file. But I don't need to fetch from database as I already have them in variables which I am fetching from a view, and looping through. It would have been no issue if data flow component took variables as source data.

blueoyster
  • 11
  • 2
  • So you need one .txt for every single record? – J.S. Orris Mar 13 '15 at 01:26
  • "as I already have them in variables which I am fetching from a view". Why not get rid of the variables and use the view to drive the file creation? If that's not an option, please explain how you are storing multiple rows in a SSIS variable. Are you using an object (ADO recordset)? – Nick.Mc Mar 13 '15 at 01:58
  • You can create a dataflow task, in there use an OLEDB source where you specify the view. Next use a scripting component as a destination and write a new file for every row. – Ako Mar 13 '15 at 08:14
  • @JeffOrris, That's correct. I need a .txt for every record – blueoyster Mar 13 '15 at 13:15
  • @Nick.McDermaid. I am using execute sql task to fetch data from a view and storing it in a recodset. Then I am enumerating using foreach ado enumerator. There are two variables that hold the values for column 1 and 2 during iteration – blueoyster Mar 13 '15 at 13:18
  • 2
    There is native functionality in the data flow task, no need for scripting. Use the Export Column Component. – billinkc Mar 13 '15 at 14:07
  • This might actually have been a better [dupe](http://stackoverflow.com/questions/12712632/export-varbinarymax-column-with-ssis) – billinkc Mar 13 '15 at 14:08
  • @billinkc Thanks! Export column worked. – blueoyster Mar 13 '15 at 17:26

0 Answers0