<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.7" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Dynamic table loading in SSIS (Part 2)</title>
	<link>http://www.proteanit.com/b/2008/07/16/dynamic-table-loading-in-ssis-part-2/</link>
	<description>pro·te·an   (prō'tē-ən, prō-tē'-)  "Exhibiting considerable versatility or diversity"</description>
	<pubDate>Fri, 30 Jul 2010 20:55:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.7</generator>

	<item>
		<title>by: Frank</title>
		<link>http://www.proteanit.com/b/2008/07/16/dynamic-table-loading-in-ssis-part-2/#comment-27290</link>
		<pubDate>Mon, 12 Oct 2009 13:22:57 +0000</pubDate>
		<guid>http://www.proteanit.com/b/2008/07/16/dynamic-table-loading-in-ssis-part-2/#comment-27290</guid>
					<description>Hi Krishna,

You heard correctly that you can't dynamically change the metadata within a dataflow. So in your case each iteration of the loop will require different column names and as you have found out, this doesn't work.

You may be able to use a combination of bcp format command and bcp export command within the loop to do this.

However, if you have the time I'd recommend that you build a dataflow for each table. Then you can take advantage of SSIS by exporting in parallel.

Thanks</description>
		<content:encoded><![CDATA[<p>Hi Krishna,</p>
<p>You heard correctly that you can&#8217;t dynamically change the metadata within a dataflow. So in your case each iteration of the loop will require different column names and as you have found out, this doesn&#8217;t work.</p>
<p>You may be able to use a combination of bcp format command and bcp export command within the loop to do this.</p>
<p>However, if you have the time I&#8217;d recommend that you build a dataflow for each table. Then you can take advantage of SSIS by exporting in parallel.</p>
<p>Thanks
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Krishna</title>
		<link>http://www.proteanit.com/b/2008/07/16/dynamic-table-loading-in-ssis-part-2/#comment-27277</link>
		<pubDate>Sun, 11 Oct 2009 16:14:29 +0000</pubDate>
		<guid>http://www.proteanit.com/b/2008/07/16/dynamic-table-loading-in-ssis-part-2/#comment-27277</guid>
					<description>Hello,
Really nice article. I am newbie in this area.
Can I implement the same in my environment? here is the scenario.

1. I have lot of different tables data to be extracted to flat files like table1, table2, table3.....tableXXX.
2. I need to run select * from each table and capturing the data in flat files by naming the file as table name.
I am trying to use foreach loop in the case but getting error...I captured table names (table1, table2 etc.,) and Query (select * from table1, select * from table2 etc., ) to a temp table and then using the variables tablename and query as variables in the foreach loop container and ending with error.

Error at Getting Data to Flatfiles [OLE DB Source [1]]: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E0C.
An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80040E0C  Description: "Command text was not set for the command object.".

So my question is ...can I use yours in my scenario? I heard some where that each table contains different columns and the each query leads to different columns and hence the columns are changing flatfile extraction is not possible. Is that correct?
Can you kindly suggest some method to my schenario?
Krishna.</description>
		<content:encoded><![CDATA[<p>Hello,<br />
Really nice article. I am newbie in this area.<br />
Can I implement the same in my environment? here is the scenario.</p>
<p>1. I have lot of different tables data to be extracted to flat files like table1, table2, table3&#8230;..tableXXX.<br />
2. I need to run select * from each table and capturing the data in flat files by naming the file as table name.<br />
I am trying to use foreach loop in the case but getting error&#8230;I captured table names (table1, table2 etc.,) and Query (select * from table1, select * from table2 etc., ) to a temp table and then using the variables tablename and query as variables in the foreach loop container and ending with error.</p>
<p>Error at Getting Data to Flatfiles [OLE DB Source [1]]: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0&#215;80040E0C.<br />
An OLE DB record is available.  Source: &#8220;Microsoft SQL Native Client&#8221;  Hresult: 0&#215;80040E0C  Description: &#8220;Command text was not set for the command object.&#8221;.</p>
<p>So my question is &#8230;can I use yours in my scenario? I heard some where that each table contains different columns and the each query leads to different columns and hence the columns are changing flatfile extraction is not possible. Is that correct?<br />
Can you kindly suggest some method to my schenario?<br />
Krishna.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Frank</title>
		<link>http://www.proteanit.com/b/2008/07/16/dynamic-table-loading-in-ssis-part-2/#comment-2418</link>
		<pubDate>Mon, 01 Sep 2008 14:54:19 +0000</pubDate>
		<guid>http://www.proteanit.com/b/2008/07/16/dynamic-table-loading-in-ssis-part-2/#comment-2418</guid>
					<description>I'm afraid I don't have any examples to hand but it should be possible if you interrogate the information schema catalogue views and write the file based on that.

To see some examples of how to do this in script component see the post on writing sql results to SSIS variable. It would require some modification to make it fit your purposes, but hopefully you will see the idea.

Finally if you want to write to a file (which you will have to do) lookup examples using streamwriter class.

Hope this helps!</description>
		<content:encoded><![CDATA[<p>I&#8217;m afraid I don&#8217;t have any examples to hand but it should be possible if you interrogate the information schema catalogue views and write the file based on that.</p>
<p>To see some examples of how to do this in script component see the post on writing sql results to SSIS variable. It would require some modification to make it fit your purposes, but hopefully you will see the idea.</p>
<p>Finally if you want to write to a file (which you will have to do) lookup examples using streamwriter class.</p>
<p>Hope this helps!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Jason</title>
		<link>http://www.proteanit.com/b/2008/07/16/dynamic-table-loading-in-ssis-part-2/#comment-2415</link>
		<pubDate>Mon, 01 Sep 2008 14:37:13 +0000</pubDate>
		<guid>http://www.proteanit.com/b/2008/07/16/dynamic-table-loading-in-ssis-part-2/#comment-2415</guid>
					<description>Thanks Protean for the code!  Your example was very helpful and helped to learn some new concepts in SSIS and bcp.   I forgot we could bcp out a format file.  

I'm working on a large project to dynamically create format files as the table width of my imports varies, i.e. one day the file as 3 date columns (if it's Jan 3), the next it has 4, the next it has 5, etc...

I'm trying to reverse engineer what you have done and apply it to my situation.

One issue I'm having is that my hosting company won't allow bcp.exe or any xp_cmdshell commands. 

Do you have any examples you can show me on how to create the format file using the script task instead of bcp.exe format?

Thanks!

Jason
lonestarfinancing[dot]com</description>
		<content:encoded><![CDATA[<p>Thanks Protean for the code!  Your example was very helpful and helped to learn some new concepts in SSIS and bcp.   I forgot we could bcp out a format file.  </p>
<p>I&#8217;m working on a large project to dynamically create format files as the table width of my imports varies, i.e. one day the file as 3 date columns (if it&#8217;s Jan 3), the next it has 4, the next it has 5, etc&#8230;</p>
<p>I&#8217;m trying to reverse engineer what you have done and apply it to my situation.</p>
<p>One issue I&#8217;m having is that my hosting company won&#8217;t allow bcp.exe or any xp_cmdshell commands. </p>
<p>Do you have any examples you can show me on how to create the format file using the script task instead of bcp.exe format?</p>
<p>Thanks!</p>
<p>Jason<br />
lonestarfinancing[dot]com
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Protean</title>
		<link>http://www.proteanit.com/b/2008/07/16/dynamic-table-loading-in-ssis-part-2/#comment-1156</link>
		<pubDate>Wed, 16 Jul 2008 11:07:48 +0000</pubDate>
		<guid>http://www.proteanit.com/b/2008/07/16/dynamic-table-loading-in-ssis-part-2/#comment-1156</guid>
					<description>&lt;strong&gt;Dynamic table loading in SSIS (Part 1)&lt;/strong&gt;

The quick answer to this is that you can&#8217;t&#8230; at least not in a dataflow. Whilst you can dynamically change environments and databases, the column metadata has to remain the same. It&#8217;s therefore fairly limited as to what you can load &#38;...</description>
		<content:encoded><![CDATA[<p><strong>Dynamic table loading in SSIS (Part 1)</strong></p>
<p>The quick answer to this is that you can&#8217;t&#8230; at least not in a dataflow. Whilst you can dynamically change environments and databases, the column metadata has to remain the same. It&#8217;s therefore fairly limited as to what you can load &amp;&#8230;
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
