<?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: Is SQL going the way of Disco?</title>
	<atom:link href="http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/feed/" rel="self" type="application/rss+xml" />
	<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/</link>
	<description>Trying to walk that thin line between intelligence and ignorance</description>
	<lastBuildDate>Tue, 09 Mar 2010 16:27:57 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Phil</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-24939</link>
		<dc:creator>Phil</dc:creator>
		<pubDate>Thu, 14 Jan 2010 16:24:12 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-24939</guid>
		<description>SQL is not going the way of the Disco. Consider, LINQ is not always good for complex SQL queries and queries that need a lot of fine-tuning. Plus, there is legacy SQL that need to be maintained. So, while it may not be as prevalent as it was in the early 2000&#039;s; it will still be around in the early 2010&#039;s.</description>
		<content:encoded><![CDATA[<p>SQL is not going the way of the Disco. Consider, LINQ is not always good for complex SQL queries and queries that need a lot of fine-tuning. Plus, there is legacy SQL that need to be maintained. So, while it may not be as prevalent as it was in the early 2000&#8217;s; it will still be around in the early 2010&#8217;s.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-22857</link>
		<dc:creator>J</dc:creator>
		<pubDate>Thu, 29 Oct 2009 18:16:12 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-22857</guid>
		<description>Hmmm...looks like it truncated my code even thoug I used code blocks...oh well.</description>
		<content:encoded><![CDATA[<p>Hmmm&#8230;looks like it truncated my code even thoug I used code blocks&#8230;oh well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-22856</link>
		<dc:creator>J</dc:creator>
		<pubDate>Thu, 29 Oct 2009 18:14:49 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-22856</guid>
		<description>Well I realize this is an old topic, but I am of the old school that would prefer to do everything in SQL. As the original commenter stated...SQL is a high level language already that abstracts away what happens when you join multiple tables etc. That being said, I was (am still?) skeptical on how LinQ to SQL does under such circumstances as data manipulation. So, I took 2 hours today, and converted a relatively simple transformation based off of the AdventureWorks DB to see what the equivalent code is like.

Original SQL:
&lt;code&gt;
Declare @StartDate datetime, @EndDate datetime

Select @StartDate = &#039;1/1/2003&#039;, @EndDate = &#039;12/31/2003&#039;;

Select *,
 Commission = TotalSales * 
				case	
					When  PctAttained &lt; 25 Then 0
					When  PctAttained &lt; 50 Then CommissionPct * 0.50
					When  PctAttained = 50
order by SalesPersonID, OrderYear, OrderMonth;
&lt;/code&gt;

My equivalent LINQ (mind you, this is my VERY FIRST Linq to SQL attempt):
 &lt;code&gt;
AWDataContext context = new AWDataContext();
            DateTime startdate, enddate;
            startdate = DateTime.Parse(&quot;1/1/2003&quot;);
            enddate = DateTime.Parse(&quot;1/1/2004&quot;);

            var query = from soh in context.SalesOrderHeaders
                        join sp in context.SalesPersons on soh.SalesPersonID equals sp.SalesPersonID
                        join c in context.Contacts on soh.SalesPersonID equals c.ContactID
                        where soh.OrderDate &gt;= startdate &amp;&amp; soh.OrderDate  c.SubTotal),
                            PctAttained = soh_group.Sum(c =&gt; c.SubTotal) / soh_group.Key.SalesQuota//,
                            //Commission = soh_group.Sum(c =&gt; c.SubTotal) / soh_group.Key.SalesQuota  .5
                             select new{q.SalesPersonID,
                                 q.FirstName,
                                 q.LastName,
                                 q.Year,
                                 q.Month,
                                 q.SalesQuota,
                                 q.CommissionPct,
                                 q.TotalSales,
                                 q.PctAttained,
                                 Commission = ( Convert.ToDouble(q.PctAttained) &gt; .75 ? Convert.ToDouble(q.TotalSales) * Convert.ToDouble(q.CommissionPct):
                                                Convert.ToDouble(q.PctAttained) &gt; .50 ? Convert.ToDouble(q.TotalSales) * Convert.ToDouble(q.CommissionPct) * .75 :
                                                Convert.ToDouble(q.PctAttained) &gt; .25 ? Convert.ToDouble(q.TotalSales) * Convert.ToDouble(q.CommissionPct) * .50 :
                                                0)
                             };
                           
            dataGridView1.DataSource = commission;
&lt;/code&gt;

I&#039;m sure I could have done this in one step, but I couldn&#039;t quite put the pieces together.

After examining the generated SQL code, I&#039;m pleased that it looks semi-decent.
Also, that being said, LINQ to SQL doesn&#039;t fit into many scenarios that I deal with on a regular basis, so I will probably continue down the plain old SQL route for the time being.</description>
		<content:encoded><![CDATA[<p>Well I realize this is an old topic, but I am of the old school that would prefer to do everything in SQL. As the original commenter stated&#8230;SQL is a high level language already that abstracts away what happens when you join multiple tables etc. That being said, I was (am still?) skeptical on how LinQ to SQL does under such circumstances as data manipulation. So, I took 2 hours today, and converted a relatively simple transformation based off of the AdventureWorks DB to see what the equivalent code is like.</p>
<p>Original SQL:<br />
<code><br />
Declare @StartDate datetime, @EndDate datetime</p>
<p>Select @StartDate = '1/1/2003', @EndDate = '12/31/2003';</p>
<p>Select *,<br />
 Commission = TotalSales *<br />
				case<br />
					When  PctAttained &lt; 25 Then 0<br />
					When  PctAttained &lt; 50 Then CommissionPct * 0.50<br />
					When  PctAttained = 50<br />
order by SalesPersonID, OrderYear, OrderMonth;<br />
</code></p>
<p>My equivalent LINQ (mind you, this is my VERY FIRST Linq to SQL attempt):<br />
 <code><br />
AWDataContext context = new AWDataContext();<br />
            DateTime startdate, enddate;<br />
            startdate = DateTime.Parse("1/1/2003");<br />
            enddate = DateTime.Parse("1/1/2004");</p>
<p>            var query = from soh in context.SalesOrderHeaders<br />
                        join sp in context.SalesPersons on soh.SalesPersonID equals sp.SalesPersonID<br />
                        join c in context.Contacts on soh.SalesPersonID equals c.ContactID<br />
                        where soh.OrderDate &gt;= startdate &amp;&amp; soh.OrderDate  c.SubTotal),<br />
                            PctAttained = soh_group.Sum(c =&gt; c.SubTotal) / soh_group.Key.SalesQuota//,<br />
                            //Commission = soh_group.Sum(c =&gt; c.SubTotal) / soh_group.Key.SalesQuota  .5<br />
                             select new{q.SalesPersonID,<br />
                                 q.FirstName,<br />
                                 q.LastName,<br />
                                 q.Year,<br />
                                 q.Month,<br />
                                 q.SalesQuota,<br />
                                 q.CommissionPct,<br />
                                 q.TotalSales,<br />
                                 q.PctAttained,<br />
                                 Commission = ( Convert.ToDouble(q.PctAttained) &gt; .75 ? Convert.ToDouble(q.TotalSales) * Convert.ToDouble(q.CommissionPct):<br />
                                                Convert.ToDouble(q.PctAttained) &gt; .50 ? Convert.ToDouble(q.TotalSales) * Convert.ToDouble(q.CommissionPct) * .75 :<br />
                                                Convert.ToDouble(q.PctAttained) &gt; .25 ? Convert.ToDouble(q.TotalSales) * Convert.ToDouble(q.CommissionPct) * .50 :<br />
                                                0)<br />
                             };</p>
<p>            dataGridView1.DataSource = commission;<br />
</code></p>
<p>I&#8217;m sure I could have done this in one step, but I couldn&#8217;t quite put the pieces together.</p>
<p>After examining the generated SQL code, I&#8217;m pleased that it looks semi-decent.<br />
Also, that being said, LINQ to SQL doesn&#8217;t fit into many scenarios that I deal with on a regular basis, so I will probably continue down the plain old SQL route for the time being.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-959</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Thu, 31 Jul 2008 22:14:53 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-959</guid>
		<description>Rob, aren&#039;t you only about a year younger than he is? :)</description>
		<content:encoded><![CDATA[<p>Rob, aren&#8217;t you only about a year younger than he is? <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-951</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Thu, 31 Jul 2008 12:51:44 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-951</guid>
		<description>I do think Ben might be considered pretty old though.</description>
		<content:encoded><![CDATA[<p>I do think Ben might be considered pretty old though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-950</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Thu, 31 Jul 2008 10:56:04 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-950</guid>
		<description>well since that&#039;s what i&#039;m already doing with all my service request batching and query batching i don&#039;t think we need to wait another 10 years ;)

and i didn&#039;t say you were old :p</description>
		<content:encoded><![CDATA[<p>well since that&#8217;s what i&#8217;m already doing with all my service request batching and query batching i don&#8217;t think we need to wait another 10 years <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>and i didn&#8217;t say you were old :p</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: den Ben (aka SQL~)</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-949</link>
		<dc:creator>den Ben (aka SQL~)</dc:creator>
		<pubDate>Thu, 31 Jul 2008 10:53:22 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-949</guid>
		<description>I think that what Stiiifff is saying is that in about 10 years you shouldn&#039;t worry about db- and/or network requests anymore.  The &#039;framework&#039; will do that for you.  If you have a hard time believing that, then consider that thought next time you are writing a linq query.

However... i also believe edge cases will still remain to exist ;-)

And I am _NOT_ old :p
dammit ;-)</description>
		<content:encoded><![CDATA[<p>I think that what Stiiifff is saying is that in about 10 years you shouldn&#8217;t worry about db- and/or network requests anymore.  The &#8216;framework&#8217; will do that for you.  If you have a hard time believing that, then consider that thought next time you are writing a linq query.</p>
<p>However&#8230; i also believe edge cases will still remain to exist <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>And I am _NOT_ old :p<br />
dammit <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stiiifff</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-948</link>
		<dc:creator>Stiiifff</dc:creator>
		<pubDate>Thu, 31 Jul 2008 09:09:36 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-948</guid>
		<description>Yeah, of course ;) I mean that, eventually, solutions to those problems are being integrated into the platform (Linq queries batching ?) and optimizations are done for you, transparently, so that you can focus on what&#039;s most important : solving business problems.</description>
		<content:encoded><![CDATA[<p>Yeah, of course <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  I mean that, eventually, solutions to those problems are being integrated into the platform (Linq queries batching ?) and optimizations are done for you, transparently, so that you can focus on what&#8217;s most important : solving business problems.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-947</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Thu, 31 Jul 2008 09:02:27 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-947</guid>
		<description>wait, just to avoid any confusion... i really don&#039;t think generating a bunch of network and/or db requests should be a part of evolution :).  No matter how fast our systems and networks are getting, it is still wrong ;)</description>
		<content:encoded><![CDATA[<p>wait, just to avoid any confusion&#8230; i really don&#8217;t think generating a bunch of network and/or db requests should be a part of evolution <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .  No matter how fast our systems and networks are getting, it is still wrong <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stiiifff</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-946</link>
		<dc:creator>Stiiifff</dc:creator>
		<pubDate>Thu, 31 Jul 2008 09:00:34 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-946</guid>
		<description>Aahahaha, excellent :) ... I made myself the same comment recently about how bad junior .Net developers generally are at SQL statements ! Hopefully they are still some (old) guys who come from the &#039;Client/Server days&#039; and had to learn stuff like Oracle&#039;s &quot;select connect by prior&quot; and other niceties ;) lol

It also made me think about my first reaction when I saw a presentation by Eric Meijer about Volta ... &quot;This is insane, the compiler breaking up the application for you ! Developers are going to write Linq queries on every tiers and they won&#039;t even notice that it will generate zillions of network / db requests&quot;. But as you said, this is part of evolution. The systems are getting smarter &amp; more complex every day passing ... it&#039;s getting close to impossible to understand how everything is working &#039;inside the box&#039;, although it will probably save you some time when things start to fall apart ;)</description>
		<content:encoded><![CDATA[<p>Aahahaha, excellent <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  &#8230; I made myself the same comment recently about how bad junior .Net developers generally are at SQL statements ! Hopefully they are still some (old) guys who come from the &#8216;Client/Server days&#8217; and had to learn stuff like Oracle&#8217;s &#8220;select connect by prior&#8221; and other niceties <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  lol</p>
<p>It also made me think about my first reaction when I saw a presentation by Eric Meijer about Volta &#8230; &#8220;This is insane, the compiler breaking up the application for you ! Developers are going to write Linq queries on every tiers and they won&#8217;t even notice that it will generate zillions of network / db requests&#8221;. But as you said, this is part of evolution. The systems are getting smarter &amp; more complex every day passing &#8230; it&#8217;s getting close to impossible to understand how everything is working &#8216;inside the box&#8217;, although it will probably save you some time when things start to fall apart <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-885</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Sat, 26 Jul 2008 11:53:33 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-885</guid>
		<description>@Kve:

i always suspected it to be pretty sad ;)</description>
		<content:encoded><![CDATA[<p>@Kve:</p>
<p>i always suspected it to be pretty sad <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kve</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-877</link>
		<dc:creator>kve</dc:creator>
		<pubDate>Fri, 25 Jul 2008 16:53:46 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-877</guid>
		<description>Yes, my world fell apart...</description>
		<content:encoded><![CDATA[<p>Yes, my world fell apart&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-857</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Wed, 23 Jul 2008 19:38:16 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-857</guid>
		<description>@Kve:

you do realize i said i wasn&#039;t a guru, right? :p</description>
		<content:encoded><![CDATA[<p>@Kve:</p>
<p>you do realize i said i wasn&#8217;t a guru, right? :p</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kve</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-852</link>
		<dc:creator>kve</dc:creator>
		<pubDate>Wed, 23 Jul 2008 13:06:38 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-852</guid>
		<description>Sorry, stopped reading somewhere at &quot;guru&quot;...</description>
		<content:encoded><![CDATA[<p>Sorry, stopped reading somewhere at &#8220;guru&#8221;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://davybrion.com/blog/2008/07/is-sql-going-the-way-of-disco/comment-page-1/#comment-850</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Wed, 23 Jul 2008 11:07:13 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=203#comment-850</guid>
		<description>Even if you write plain old sql you have no idea how the database is going to execute it. Query &quot;optimizers&quot; and stuff already analyze your sql and create executionpaths you can&#039;t easily foresee.</description>
		<content:encoded><![CDATA[<p>Even if you write plain old sql you have no idea how the database is going to execute it. Query &#8220;optimizers&#8221; and stuff already analyze your sql and create executionpaths you can&#8217;t easily foresee.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
