<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code Reference &#187; SQL</title>
	<atom:link href="http://sullivan.net/blog/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://sullivan.net/blog</link>
	<description>A collection of code for my reference (and perhaps other people too)</description>
	<lastBuildDate>Wed, 25 Jan 2012 17:53:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Temporary tables in SSIS</title>
		<link>http://sullivan.net/blog/2010/02/temporary-tables-in-ssis/</link>
		<comments>http://sullivan.net/blog/2010/02/temporary-tables-in-ssis/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 09:35:38 +0000</pubDate>
		<dc:creator>Darren</dc:creator>
				<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SSIS]]></category>

		<guid isPermaLink="false">http://sullivan.net/blog/?p=253</guid>
		<description><![CDATA[On one of our projects, we had some SQL that contained a temp table. This temp table is not one that will be used across several Data Flow Tasks. It is only used within a single one. I don't want to hear the arguments for not using temp tables. Sometimes you just have to. We [...]]]></description>
			<content:encoded><![CDATA[<p>On one of our projects, we had some SQL that contained a temp table. This temp table is not one that will be used across several Data Flow Tasks. It is only used within a single one.</p>
<p>I don't want to hear the arguments for not using temp tables. Sometimes you just have to. We found ourselves with one of those situations.</p>
<p>After a lot of research and reading of other people's blog posts, I found a solution.</p>
<p>We had been using an OLE DB connection to our database.<br />
Inside our Data Flow Task we placed our SQL inside an OLE DB Source.<br />
None of the suggested solutions I read thru allowed me to use a temp table.</p>
<p>Our solution....</p>
<p>Use an ADO DB connection. Then an ADO NET Source.<br />
Then under the properties of the ADO DB connection, we set<br />
 - RetainSameConnection = True<br />
 - DelayValidation = True<br />
Most important, we didn't use a temporary table (CREATE TABLE #Res .....). We used a variable table (DECLARE @Res TABLE .....) instead.</p>
<p>That did the trick.</p>
<p>I am glad this worked because I really didn't want to deal with Global tables or defining a global table in the DB ahead of time or any workarounds like that. This was simple and it worked.</p>
<p>For some reason, this won't work with an OLE DB connection. We think we know why, but have not found the documentation it. </p>
]]></content:encoded>
			<wfw:commentRss>http://sullivan.net/blog/2010/02/temporary-tables-in-ssis/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

