﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Integration Services / Data Warehousing  / Integration Services. Exporting to multiple CSV Files based on a Column in the table as a variable / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 19 May 2013 14:45:29 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Integration Services. Exporting to multiple CSV Files based on a Column in the table as a variable</title><link>http://www.sqlservercentral.com/Forums/Topic1420620-364-1.aspx</link><description>thats just what I wanted!!!!thankyou for that :-) Its becoming much clearer now.</description><pubDate>Mon, 18 Feb 2013 08:09:55 GMT</pubDate><dc:creator>Debbie Edwards</dc:creator></item><item><title>RE: Integration Services. Exporting to multiple CSV Files based on a Column in the table as a variable</title><link>http://www.sqlservercentral.com/Forums/Topic1420620-364-1.aspx</link><description>In your querySELECT A, B, C, D, E,F From source tableWHERE Dfes_Number = @DFES_Numberchange the @DFES_Number to a question markSELECT A, B, C, D, E,F From source tableWHERE Dfes_Number = ?Click the Parameters button on your Source Editor and put your @DFES_Number in there.Another approach I like to take in a situation like this is to create an expression driven variable for my query and put the query together with the expression.   For example a new variable named SQLQuery with an expression something like"SELECT A,B,C,D,E,F, FROM SourceTable WHERE DFES_Number =" + (DT_STR, 4, 1252)@DFES_NumberThen in the Source editor use a SQL Command from Variable and select the SQLQuery variable as your query source.</description><pubDate>Mon, 18 Feb 2013 08:07:25 GMT</pubDate><dc:creator>Daniel Bowlin</dc:creator></item><item><title>Integration Services. Exporting to multiple CSV Files based on a Column in the table as a variable</title><link>http://www.sqlservercentral.com/Forums/Topic1420620-364-1.aspx</link><description>Hi I seem to have completely forgotten how to do this and cant make it workI have a SQL Table and I want to export to data CSV based on a specific column in the table. Firstly I have an execute SQL Task with one column in it DFES_NumberFor example DFES_Number0001000200030004ResultSet = 0 ResultName = CreateVariable (0 because its using the whole table in this case just the one column at the moment)Next I have a Foreachloop container. In this case inCollection  and Enumerator = Foreach ADO EnumeratorThe Ado Source variable is User::CreateVariable (As above)The variable Mappings in DFES_Number with an index of 0Within this for look I have a data flow task.The source is a SQL Database. I have tried to set it up so it goes SELECT A, B, C, D, E,F From source tableWHERE Dfes_Number  = @DFES_NumberBut in all cases Im getting Statement could not be prepared ‘Must declare the scalar variable DFES_Number’ I thought I had done this as within my variables list I have a DFES_Number set as string.Im now at a loss. Im trying to find some good guides on how to use a SQL Destination and export to multiple CSV files but Im not doing a very good job.If anyone could help it would be much appreciated.</description><pubDate>Fri, 15 Feb 2013 09:25:51 GMT</pubDate><dc:creator>Debbie Edwards</dc:creator></item></channel></rss>