<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: A Haunting SQL Statement</title>
	<atom:link href="http://dustyreagan.com/haunting-sql-statement/feed/" rel="self" type="application/rss+xml" />
	<link>http://dustyreagan.com/haunting-sql-statement/</link>
	<description>On Technology &#38; Entrepreneurship</description>
	<lastBuildDate>Sat, 28 Jan 2012 10:10:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Dusty Reagan</title>
		<link>http://dustyreagan.com/haunting-sql-statement/comment-page-1/#comment-21</link>
		<dc:creator>Dusty Reagan</dc:creator>
		<pubDate>Sat, 29 Jul 2006 02:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://dev.dustyreagan.com/?p=14#comment-21</guid>
		<description>Oh yes, that&#039;s quite an elegant solution to my language select list problem. Thanks for the input!I&#039;m glad you enjoyed the haunted statement. As far as daisy chaining equality assignments in SQL being documented... sure it is! You can read about it on www.dustyreagan.com! ;) heheThanks again for the feedback Zackaroo. It&#039;s greatly appreciated.</description>
		<content:encoded><![CDATA[<p>Oh yes, that&#8217;s quite an elegant solution to my language select list problem. Thanks for the input!I&#8217;m glad you enjoyed the haunted statement. As far as daisy chaining equality assignments in SQL being documented&#8230; sure it is! You can read about it on <a href="http://www.dustyreagan.com" rel="nofollow">http://www.dustyreagan.com</a>! <img src='http://dustyreagan.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  heheThanks again for the feedback Zackaroo. It&#8217;s greatly appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zackaroo</title>
		<link>http://dustyreagan.com/haunting-sql-statement/comment-page-1/#comment-20</link>
		<dc:creator>Zackaroo</dc:creator>
		<pubDate>Wed, 05 Jul 2006 08:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://dev.dustyreagan.com/?p=14#comment-20</guid>
		<description>The haunting Sql statement article is &lt;i&gt;AWESOME&lt;/i&gt;.  All this time working in Sql, and I had no idea you could daisy chain equality assignments like that.  Areyou sure that&#039;s documented?  LOL.The language list though... I think you&#039;re taking 3 steps to do what could be done in 1.  I know this is a small dataset so it&#039;s not obvious that even aseveralfold improvement in performance makes a practical difference, but... if this procis being called from a website that&#039;s getting hit by a gazillion users for example, it could become relevant.  Also, you&#039;re doing an update statement at one point, which is a logged operation, which will also impact speed performance, and if you&#039;ve got a gazillion usershitting your website, your log will start to fill up.The first thing you could do, is replace your temp table usage with a table variable, and do an insert into that, rather than a select into the temp table.  Because table variables arescoped, SQL nows whatever table you&#039;re constructing will disappear after the code that&#039;s using it is done running.  So, inserts, updates, and deletes into, to, and from  table variables are &lt;i&gt;not&lt;/i&gt; logged.But even simpler and faster, you could do this:select l.LanguageCode,lln.LanguageNamefrom dbo.LocalLanguageName llnjoin dbo.Language l on lln.LanguageId = l.LanguageIdwhere lln.LocalLanguageId = @LocalLanguageIdorder by  case when l.LanguageCode = @LanguageCode then 0 else 1 end ,lln.LanguageNameBut man, I gotta go back and give you kudos for the haunting Sql thing a second time.  I can already think of a dozen places in my own code where that will comein &lt;i&gt;very&lt;/i&gt; handy.</description>
		<content:encoded><![CDATA[<p>The haunting Sql statement article is <i>AWESOME</i>.  All this time working in Sql, and I had no idea you could daisy chain equality assignments like that.  Areyou sure that&#8217;s documented?  LOL.The language list though&#8230; I think you&#8217;re taking 3 steps to do what could be done in 1.  I know this is a small dataset so it&#8217;s not obvious that even aseveralfold improvement in performance makes a practical difference, but&#8230; if this procis being called from a website that&#8217;s getting hit by a gazillion users for example, it could become relevant.  Also, you&#8217;re doing an update statement at one point, which is a logged operation, which will also impact speed performance, and if you&#8217;ve got a gazillion usershitting your website, your log will start to fill up.The first thing you could do, is replace your temp table usage with a table variable, and do an insert into that, rather than a select into the temp table.  Because table variables arescoped, SQL nows whatever table you&#8217;re constructing will disappear after the code that&#8217;s using it is done running.  So, inserts, updates, and deletes into, to, and from  table variables are <i>not</i> logged.But even simpler and faster, you could do this:select l.LanguageCode,lln.LanguageNamefrom dbo.LocalLanguageName llnjoin dbo.Language l on lln.LanguageId = l.LanguageIdwhere lln.LocalLanguageId = @LocalLanguageIdorder by  case when l.LanguageCode = @LanguageCode then 0 else 1 end ,lln.LanguageNameBut man, I gotta go back and give you kudos for the haunting Sql thing a second time.  I can already think of a dozen places in my own code where that will comein <i>very</i> handy.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

