<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqladvice.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">bSwartz's SQL Server Blog</title><subtitle type="html">Performance is what you make of it...</subtitle><id>http://sqladvice.com/blogs/bswartz/atom.aspx</id><link rel="alternate" type="text/html" href="http://sqladvice.com/blogs/bswartz/default.aspx" /><link rel="self" type="application/atom+xml" href="http://sqladvice.com/blogs/bswartz/atom.aspx" /><generator uri="http://communityserver.org" version="2.1.60809.935">Community Server</generator><updated>2005-04-13T20:19:00Z</updated><entry><title>SQL 2005's new PIVOT functionality</title><link rel="alternate" type="text/html" href="http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx" /><id>http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx</id><published>2005-12-27T04:46:00Z</published><updated>2005-12-27T04:46:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;New with SQL Server 2005 are some really cool T-SQL enhancements.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;One that I was really looking forward to sinking my teeth into was the PIVOT/UNPIVOT enhancements to the Select statement. That was until I started to use it. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;After a little frustration I figured out the PIVOT's idiosyncrasies and was pretty disappointed in some basic functionality that is missing. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;First, let’s talk about “how” to use it in the most basic fashion. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Using your select statement, you create the query as you typically would, then you add the following to it. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;SQL 2000&lt;/STRONG&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;FONT&gt;SELECT GroupByColumn1,GroupByColumn2,&lt;BR&gt;Max(&lt;BR&gt;CASE&lt;BR&gt;when PivotColumn = ‘abc’ then PivotColumn else null&lt;BR&gt;when PivotColumn = ‘def’ then PivotColumn else null&lt;BR&gt;END&lt;BR&gt;)&lt;BR&gt;FROM myTable&lt;BR&gt;GROUP BY groupByColumn1,GroupByColumn2&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;SQL 2005 &lt;/STRONG&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;FONT&gt;SELECT * FROM myTable&lt;BR&gt;PIVOT ((Aggregate function) FOR Column Name IN (List of Values))&lt;BR&gt;AS AliasName&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT face=Verdana size=2&gt;Seems pretty basic right?? (Not really)&lt;BR&gt;&lt;BR&gt;The Aggregate function replaces your normal aggregate wrapper for the case statement, and the List of values are the values you would use within the case statement. The problem (and the missing functionality) is in the List of Values.&lt;BR&gt;&lt;BR&gt;You would think given that the values MUST be convertible to NVarchar that a string is what is being called for. And strings are typically quoted like this ‘abcdefg’. Well, not so with this option. &lt;/FONT&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Something like this will not work.&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;FONT&gt;PIVOT (MAX(value) FOR myColumn IN ('11/18/2005','11/19/2005','11/20/2005') )&lt;BR&gt;AS myAlias&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;The SQL Parser wants to see a “raw” or bracketed values from the result set. So you MUST do something like this.&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;FONT&gt;PIVOT (MAX(value) FOR myColumn IN ([11/18/2005],[11/19/2005],[11/20/2005]) )&lt;BR&gt;AS myAlias&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;Or&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;FONT&gt;PIVOT (MAX(value) FOR myColumn IN (abc,def,hij) )&lt;BR&gt;AS myAlias&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT face=Verdana size=2&gt;Here’s where the missing functionality comes in. &amp;gt;&amp;gt;&amp;gt; A sub query will not work in the place of the column list. The following will not work. &lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;FONT&gt;PIVOT (MAX(value) FOR myColumn IN (SELECT myPivotcolumn FROM MyTable) )&lt;BR&gt;AS myAlias&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;As I was working with this, I thought.. You have got to be kidding. Is this really a limitation? I tried every which way I could to make this work.. If anyone can prove me wrong, PLEASE do so…&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;So, to get around this, I do something like this. For all the folks that are going to throw stones about the dynamic SQL, I don’t like doing dynamic SQL either… But I don’t see a way around it in this case.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;DECLARE @Dates varchar(2000)&lt;BR&gt;SET @dates = ''&lt;BR&gt;&lt;FONT color=#006400&gt;--// Get a list of the pivot columns that are important to you.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;SELECT @Dates = @Dates + '[' + convert(varchar(12),CaptureDate,101) + '],'&lt;BR&gt;FROM (SELECT Distinct CaptureDate FROM DurationSummary) Duration&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;FONT color=#006400&gt;--// Remove the trailing comma&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT&gt;&lt;FONT face=Verdana size=2&gt;SET @Dates = LEFT(@Dates, LEN(@Dates) - 1)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;FONT color=#006400&gt;--// Now execute the Select with the PIVOT and dynamically add the list&lt;BR&gt;--// of dates for the columns&lt;/FONT&gt;&lt;BR&gt;EXEC( &lt;FONT color=#ff0000&gt;'SELECT * FROM DurationSummary PIVOT (MAX(Quantity) FOR CaptureDate IN ('&lt;/FONT&gt; + @Dates + &lt;FONT color=#ff0000&gt;')) AS X' &lt;/FONT&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Merry Christmas / Happy Holidays &amp;amp; a VERY Happy New Year!!!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Bill &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx&amp;amp;;subject=SQL+2005%27s+new+PIVOT+functionality" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx&amp;amp;;title=SQL+2005%27s+new+PIVOT+functionality" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx&amp;amp;title=SQL+2005%27s+new+PIVOT+functionality" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx&amp;amp;;title=SQL+2005%27s+new+PIVOT+functionality" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx&amp;amp;;title=SQL+2005%27s+new+PIVOT+functionality&amp;amp;;top=1" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/12/27/14463.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://sqladvice.com/aggbug.aspx?PostID=14463" width="1" height="1"&gt;</content><author><name>bswartz</name><uri>http://sqladvice.com/members/bswartz.aspx</uri></author></entry><entry><title>Thinking about migrating to SQL Server 2005?</title><link rel="alternate" type="text/html" href="http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx" /><id>http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx</id><published>2005-07-29T15:52:00Z</published><updated>2005-07-29T15:52:00Z</updated><content type="html">&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#ff0000&gt;Shameless plug&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp;&lt;A href="http://www.windowsitpro.com/roadshows/sqlserverusa/index.cfm?code=bswartz"&gt;Migrating to SQL Server 2005&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;SQL Server 2005&amp;#8217;s release is just a few months away. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;If your not excited about it, you&amp;#8217;re either don&amp;#8217;t care about SQL Server technology, you&amp;#8217;re still on SQL Server 6.5, or your in one of those jobs where you&amp;#8217;re working 20 hour days and don&amp;#8217;t see how you&amp;#8217;ll ever find time to learn about the new server(I empathize with you). &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Software has gotten boring lately.&amp;nbsp;&amp;nbsp; Back in the days when Windows 95 first came out, there were soooo many new software packages being delivered that were really cool, or really made a difference.&amp;nbsp;&amp;nbsp; I think SQL Server 2005 is in the &amp;#8220;cool&amp;#8220; software category..&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Here&amp;#8217;s some things that I&amp;#8217;m personally interested in. &lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;A new Enterprise Manager with Intellisense.. Yippeeee&amp;#8230; (SQL Server Workbench).&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;A new way of inserting business logic into the database (Procs / Managed code with DotNet languages) (DBA&amp;#8217;s beware) &lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;A completely new DTS implementation (Lets hope it&amp;#8217;s more developer friendly than the old one)&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;New Views for system objects, new ways to partition objects. &lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;SQL Stuff &amp;#8211; Recursive queries (Finally!!!), Pivot functionality and&amp;nbsp;Synonyms&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;New DataTypes varchar(max) and XML (as a datatype)&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;New Analysis Services with native XML/A.. (will anyone ever really adopt this as a standard?)&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;So if you already are thinking about moving towards SQL Server 2005 and want some migration advice, or just want to hear from some folks that have been working with this platform for some time, consider signing up for the &lt;/FONT&gt;&lt;A href="http://www.windowsitpro.com/roadshows/sqlserverusa/index.cfm?code=bswartz"&gt;&lt;FONT face=Verdana size=2&gt;Migrating to SQL Server 2005 Road Show.&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; This is put on by SQL Server Magazine, so you know it&amp;#8217;s from someone that&amp;#8217;s focused on the platform you love!&lt;/FONT&gt;&lt;/P&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx&amp;amp;;subject=Thinking+about+migrating+to+SQL+Server+2005%3f" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx&amp;amp;;title=Thinking+about+migrating+to+SQL+Server+2005%3f" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx&amp;amp;title=Thinking+about+migrating+to+SQL+Server+2005%3f" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx&amp;amp;;title=Thinking+about+migrating+to+SQL+Server+2005%3f" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx&amp;amp;;title=Thinking+about+migrating+to+SQL+Server+2005%3f&amp;amp;;top=1" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/07/29/4278.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://sqladvice.com/aggbug.aspx?PostID=4278" width="1" height="1"&gt;</content><author><name>bswartz</name><uri>http://sqladvice.com/members/bswartz.aspx</uri></author></entry><entry><title>Creating DotNet COM objects for DTS</title><link rel="alternate" type="text/html" href="http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx" /><id>http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx</id><published>2005-07-13T15:45:00Z</published><updated>2005-07-13T15:45:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma size=2&gt;SQL Servers DTS (Data Transformation Services) can be a huge pain in the butt, but it also has some great tools for data migration / loading.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;So if you&amp;#8217;re moving lots of data between databases / servers, chances are you are probably using it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma&gt;&lt;FONT size=2&gt;I spend a lot of my time in the DTS world, and have gotten used to its idiosyncrasies and short-comings.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;I was recently educated on a&amp;nbsp;method that will make me more productive and provide greater functionality for my DTS packages.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma&gt;&lt;FONT size=2&gt;Create and call your own COM component in the ActiveX Script Task. (Thanks to Jay Meekin at &lt;A href="http://www.magenic.com"&gt;Magenic Inc &lt;/A&gt;(my new Employer)&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma&gt;&lt;FONT size=2&gt;But&amp;#8230;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I&amp;#8217;m not just creating any COM object, I&amp;#8217;m using C# to do this.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Mingling the old with the new so to speak.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma size=2&gt;This might not be new to some of you more advanced developers, since I've never coded a COM object, it was a little out of my comfort zone, but really wasn't difficult at all.&amp;nbsp;&amp;nbsp;Database folks that spend their time only writing SQL for their DTS packages should definitely spend time to explore this option.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma size=2&gt;So why is this a big deal??&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DTS has no way to re-use subroutines or methods in it&amp;#8217;s ActiveX tasks.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;You have 3 choices in DTS if you want to reuse code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in" type=1&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l1 level1 lfo1; tab-stops: list .5in"&gt;&lt;FONT face=Tahoma size=2&gt;Copy and paste between a bunch of DTS ActiveX scripts. (not really re-use)&lt;/FONT&gt; 
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l1 level1 lfo1; tab-stops: list .5in"&gt;&lt;FONT face=Tahoma size=2&gt;Write only SQL related code and call stored procedures&lt;/FONT&gt; 
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l1 level1 lfo1; tab-stops: list .5in"&gt;&lt;FONT face=Tahoma size=2&gt;(my new favorite)&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Write your own com object and call it in your ActiveX Task.&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma size=2&gt;To help you get started, here&amp;#8217;s a quick cheat sheet.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;OL style="MARGIN-TOP: 0in" type=1&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo2; tab-stops: list .5in"&gt;&lt;FONT face=Tahoma size=2&gt;Create your Class / Methods in a dotNet language (you must have a constructor that has no parameters)&lt;/FONT&gt; 
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo2; tab-stops: list .5in"&gt;&lt;FONT face=Tahoma size=2&gt;Put the&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;DLL in %SystemRoot%\System32 (On all the boxes that will execute the DTS Package)&lt;/FONT&gt; 
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo2; tab-stops: list .5in"&gt;&lt;FONT face=Tahoma size=2&gt;Run REGASM to register the DLL (you might have to search for this if it&amp;#8217;s not in your path)&lt;/FONT&gt; 
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo2; tab-stops: list .5in"&gt;&lt;FONT face=Tahoma size=2&gt;Add CreateObject(&amp;#8220;YourNameSpace.YourClassName&amp;#8221;) to your ActiveX Script&lt;/FONT&gt; 
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo2; tab-stops: list .5in"&gt;&lt;FONT face=Tahoma size=2&gt;Have Fun!!&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo2; tab-stops: list .5in"&gt;&lt;FONT face=Tahoma size=2&gt;Bill&lt;/FONT&gt;&lt;/P&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx&amp;amp;;subject=Creating+DotNet+COM+objects+for+DTS" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx&amp;amp;;title=Creating+DotNet+COM+objects+for+DTS" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx&amp;amp;title=Creating+DotNet+COM+objects+for+DTS" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx&amp;amp;;title=Creating+DotNet+COM+objects+for+DTS" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx&amp;amp;;title=Creating+DotNet+COM+objects+for+DTS&amp;amp;;top=1" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/07/13/4277.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://sqladvice.com/aggbug.aspx?PostID=4277" width="1" height="1"&gt;</content><author><name>bswartz</name><uri>http://sqladvice.com/members/bswartz.aspx</uri></author></entry><entry><title>Why you should treat the database as a sacred item.</title><link rel="alternate" type="text/html" href="http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx" /><id>http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx</id><published>2005-05-02T16:50:00Z</published><updated>2005-05-02T16:50:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma size=2&gt;I get asked to teach junior developers about SQL Server on a frequent basis.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;I had an interesting question posed to me yesterday that I thought was very astute of the developer.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;He asked &amp;#8220;What is so different about a database server versus any other platform&amp;#8221;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face=Tahoma&gt;This is actually a pet peeve of mine.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Some developers don&amp;#8217;t treat it any differently and I think database servers should be seen as a sacred item.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;I re-wrote one query written by a VB programmer many years ago that was taking 7 hours to complete..&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;My new query ran in 30 seconds..&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma size=2&gt;Even though the &amp;#8220;server&amp;#8221; is multi threaded, &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;when it comes down to row level access, no matter how you look at it, that row can&amp;#8217;t be shared when performing updates.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma size=2&gt;For this reason alone, you should ALWAYS be concerned about optimizing that task you are currently coding.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Most developers can code a Select or Insert.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;But, do you stop and take the time to ask yourself if it really is the most efficient way to perform the task?&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I know I know, it doesn&amp;#8217;t always matter, but if you develop the discipline to at least think about it, you&amp;#8217;ll be a much better database developer.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face=Tahoma&gt;Quoting some much smarter people than myself, 80% of performance issues are related to the code and NOT the infrastructure.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma size=2&gt;My recommendations:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma size=2&gt;Check out &lt;A href="http://www.sql-server-performance.com"&gt;http://www.sql-server-performance.com&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma size=2&gt;If you are using transactions in your stored procedures, try to make sure that only Inserts, Updates and Deletes and error handling are between the BEGIN TRANSACTION and COMMIT TRANSACTION.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;This is not always possible, but at least ask yourself if it is possible.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;When you issue that BEGIN TRANSACTION, the Lock Manager puts up that big red stop sign and no-one else gets through until you are done.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;So if you have one Insert, 10 reads and then a second insert, you&amp;#8216;ve dramatically extended that Lock.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;&lt;FONT face=Tahoma size=2&gt;If you are writing a complex select statement, be sure to use the Estimated Execution Plan in Query Analyzer.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;You don&amp;#8217;t have to understand all the actions that are performed to get a benefit from the Execution Plan.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Visually take a look at the size of the arrows and the estimated row counts.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;If you have 10 steps and the final row count is 2 rows, but you carry 7 million rows through each step until the last one, &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;you can probably write the query differently to make it perform better.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Tahoma size=2&gt;Performance is what you make of it!!&lt;/FONT&gt;&lt;/P&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx&amp;amp;;subject=Why+you+should+treat+the+database+as+a+sacred+item." target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx&amp;amp;;title=Why+you+should+treat+the+database+as+a+sacred+item." target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx&amp;amp;title=Why+you+should+treat+the+database+as+a+sacred+item." target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx&amp;amp;;title=Why+you+should+treat+the+database+as+a+sacred+item." target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx&amp;amp;;title=Why+you+should+treat+the+database+as+a+sacred+item.&amp;amp;;top=1" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/05/02/4276.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://sqladvice.com/aggbug.aspx?PostID=4276" width="1" height="1"&gt;</content><author><name>bswartz</name><uri>http://sqladvice.com/members/bswartz.aspx</uri></author></entry><entry><title>Large columns (text,nText,image) and use of "Text in Row"</title><link rel="alternate" type="text/html" href="http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx" /><id>http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx</id><published>2005-04-14T00:47:00Z</published><updated>2005-04-14T00:47:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;Mike Campbell was sharing his thoughts on using the &lt;FONT color=#ff0000&gt;&lt;STRONG&gt;&amp;#8220;Text in Row&amp;#8221;&lt;/STRONG&gt;&lt;/FONT&gt; option of &lt;STRONG&gt;&lt;FONT color=#ff0000&gt;sp_tableOption&lt;/FONT&gt;&lt;/STRONG&gt; system procedure on the SqlAdvice list, so I thought I would expand on it a little.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;If you choose to use text, nText or image columns because the data just &amp;#8220;might&amp;#8221; grow to a size greater than 8060 bytes. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;Lookup &lt;STRONG&gt;&lt;FONT color=#ff0000&gt;sp_tableOption&lt;/FONT&gt;&lt;/STRONG&gt; and read up on the &lt;STRONG&gt;&lt;FONT color=#ff0000&gt;&amp;#8220;text in row&amp;#8221;&lt;/FONT&gt;&lt;/STRONG&gt; option.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;This is a way to have your cake and eat it too when it comes to huge amounts of variability with these columns.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;Think of these columns as a place to store your extra large mobile RV.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In my city there is a law that says you cannot store a vehicle larger than say 22 feet on your property. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;So you have to store the RV at your local self storage unit or some other place out in the country.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;So, in order to use this RV, your buddy, aunt or wife has to drive you to the storage place, pick up your RV and both of you drive it back to the house to load it up for the trip.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;BUT.... If your RV is less than 22 feet long, the city is ok with you parking it in your driveway.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;If you don&amp;#8217;t use the &lt;FONT color=#ff0000&gt;&lt;STRONG&gt;&amp;#8220;text in columns&amp;#8221;&lt;/STRONG&gt;&lt;/FONT&gt; option, the database defaults to the same extra overhead as the RV trip.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;The database will store a pointer in the data row and the &amp;#8220;data&amp;#8221; are stored in a &amp;#8220;collection of pages&amp;#8221;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Which means that if your text is only 2k bytes you have the added overhead of looking up the pointer and traveling to the &amp;#8220;other pages&amp;#8221; and retrieving the data. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;IE, a trip to the Self Storage Yard..&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;So, if you estimate that most of your data will be smaller, let's say 2048 bytes, and you want to keep the potential for a 2GB possibility, use the &lt;STRONG&gt;&lt;FONT color=#ff0000&gt;&amp;#8220;text in column&amp;#8221;&lt;/FONT&gt;&lt;/STRONG&gt; to keep it most of your data&amp;nbsp;in the same data row / page.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;But, be careful.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;This performance gain is &lt;STRONG&gt;only available IF&lt;/STRONG&gt; you have space left in the data row.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;So if all your other columns add up to 7k and your nText column is 2048, you get to go to the storage yard anyway &amp;lt;grin&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx&amp;amp;;subject=Large+columns+(text%2cnText%2cimage)+and+use+of+%22Text+in+Row%22" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx&amp;amp;;title=Large+columns+(text%2cnText%2cimage)+and+use+of+%22Text+in+Row%22" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx&amp;amp;title=Large+columns+(text%2cnText%2cimage)+and+use+of+%22Text+in+Row%22" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx&amp;amp;;title=Large+columns+(text%2cnText%2cimage)+and+use+of+%22Text+in+Row%22" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx&amp;amp;;title=Large+columns+(text%2cnText%2cimage)+and+use+of+%22Text+in+Row%22&amp;amp;;top=1" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4275.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://sqladvice.com/aggbug.aspx?PostID=4275" width="1" height="1"&gt;</content><author><name>bswartz</name><uri>http://sqladvice.com/members/bswartz.aspx</uri></author></entry><entry><title>Welcome!!!</title><link rel="alternate" type="text/html" href="http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx" /><id>http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx</id><published>2005-04-14T00:19:00Z</published><updated>2005-04-14T00:19:00Z</updated><content type="html">&lt;P&gt;I've not been a huge fan of blogging because I think it's a little weird that people share their lives over the internet with a lot of strangers..&amp;nbsp;&amp;nbsp; Kind of voyeuristic if you ask me..&lt;/P&gt;
&lt;P&gt;However, when asked to participate in the SqlAdvice Blog It occurred to me that it&amp;#8217;s not such a bad forum to share technical idea&amp;#8217;s and thoughts..&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; I've always enjoyed teaching and this can clearly be such a medium for&amp;nbsp;sharing knowledge...&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;And maybe it will lead to a book deal or even a movie some day&amp;#8230;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I can hear the phones ringing now!!&lt;/P&gt;
&lt;P&gt;Just shows you &lt;FONT color=#ff0000&gt;CAN&lt;/FONT&gt; teach an old dog new tricks...&lt;/P&gt;
&lt;P&gt;So here I am.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx&amp;amp;;subject=Welcome!!!" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx&amp;amp;;title=Welcome!!!" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx&amp;amp;title=Welcome!!!" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx&amp;amp;;title=Welcome!!!" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx&amp;amp;;title=Welcome!!!&amp;amp;;top=1" target="_blank" title = "Post http://sqladvice.com/blogs/bswartz/archive/2005/04/13/4274.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://sqladvice.com/aggbug.aspx?PostID=4274" width="1" height="1"&gt;</content><author><name>bswartz</name><uri>http://sqladvice.com/members/bswartz.aspx</uri></author></entry></feed>