<?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>J-dee.com &#187; SQL</title>
	<atom:link href="http://www.j-dee.com/category/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.j-dee.com</link>
	<description>Liverpool ASP.NET Developer - C#, jQuery, Js, Rails, SQL, Agile, OOP, Cool Web Tech</description>
	<lastBuildDate>Mon, 04 Oct 2010 21:21:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Microsoft SQL Server Data Services</title>
		<link>http://www.j-dee.com/2008/03/06/microsoft-sql-server-data-services/</link>
		<comments>http://www.j-dee.com/2008/03/06/microsoft-sql-server-data-services/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 09:06:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SSDS]]></category>

		<guid isPermaLink="false">http://www.j-dee.com/2008/03/06/microsoft-sql-server-data-services/</guid>
		<description><![CDATA[The big news from Mix08 seems to be the public beta of Microsoft SQL Server Data Services, cloud based super scalable data storage. This has big implications for the way that web applications can be designed and deployed, not least the reduced cost of not having to splash out for infrastructure and expensive licenses. Mixed [...]]]></description>
			<content:encoded><![CDATA[<p>The big news from Mix08 seems to be the public beta of Microsoft SQL Server Data Services, cloud based super scalable data storage. This has big implications for the way that web applications can be designed and deployed, not least the reduced cost of not having to splash out for infrastructure and expensive licenses. Mixed with seamless access via SOAP and REST it makes a compelling option for persisting in the cloud. Linkage <a target="_blank" href="http://www.microsoft.com/sql/dataservices/default.mspx">here</a>, <a target="_blank" href="http://blogs.msdn.com/jerrydixon/archive/2008/03/05/microsoft-sql-server-data-services.aspx">here</a> and <a target="_blank" href="http://blogs.conchango.com/jamiethomson/archive/2008/03/06/sql-server-data-services-raises-questions-straightaway.aspx">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.j-dee.com/2008/03/06/microsoft-sql-server-data-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Efficient data paging with SQL Server 2005 using ROW_NUMBER()</title>
		<link>http://www.j-dee.com/2007/08/08/efficient-data-paging-with-sql-server-2005-using-row_number/</link>
		<comments>http://www.j-dee.com/2007/08/08/efficient-data-paging-with-sql-server-2005-using-row_number/#comments</comments>
		<pubDate>Wed, 08 Aug 2007 14:06:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.j-dee.com/2007/08/08/efficient-data-paging-with-sql-server-2005-using-row_number/</guid>
		<description><![CDATA[Paging large amounts of data in SQL Server 2000 used to be a real pain, creating temporary tables, suffering bad performance after the first few batches of data or using ROWCOUNT to ignore large numbers of rows. Luckily SQL Server 2005 delivers a couple of new functions to make efficient painless data paging a reality. [...]]]></description>
			<content:encoded><![CDATA[<p>Paging large amounts of data in SQL Server 2000 used to be a real pain, creating temporary tables, suffering bad performance after the first few batches of data or using ROWCOUNT to ignore large numbers of rows. Luckily SQL Server 2005 delivers a couple of new functions to make efficient painless data paging a reality. This is something I picked up from building some <a href="http://www.dotnetgo.com">windows server monitoring</a> software . Enter the ROW_NUMBER() function.</p>
<p>All ROW_NUMBER() and it&#8217;s partner OVER does is to add a virtual row number to the start of each row returned. That&#8217;s it. Nothing more dramatic than that. Take a look at this query:</p>
<pre class="csharpcode">SELECT CallID, ROW_NUMBER() OVER (ORDER BY ID) AS Row
FROM CallRecords</pre>
<style type="text/css">                .csharpcode, .csharpcode pre  {  	font-size: small;  	color: black;  	font-family: consolas, "Courier New", courier, monospace;  	background-color: #ffffff;  	/*white-space: pre;*/  }  .csharpcode pre { margin: 0em; }  .csharpcode .rem { color: #008000; }  .csharpcode .kwrd { color: #0000ff; }  .csharpcode .str { color: #006080; }  .csharpcode .op { color: #0000c0; }  .csharpcode .preproc { color: #cc6633; }  .csharpcode .asp { background-color: #ffff00; }  .csharpcode .html { color: #800000; }  .csharpcode .attr { color: #ff0000; }  .csharpcode .alt   {  	background-color: #f4f4f4;  	width: 100%;  	margin: 0em;  }  .csharpcode .lnum { color: #606060; }</style>
<p>which returns:</p>
<pre class="csharpcode">CallID    Row
101        1
102        2
103        3
104        4
105        5
106        6
107        7
108        8
109        9
110        10

(10 row(s) affected)</pre>
<style type="text/css">                .csharpcode, .csharpcode pre  {  	font-size: small;  	color: black;  	font-family: consolas, "Courier New", courier, monospace;  	background-color: #ffffff;  	/*white-space: pre;*/  }  .csharpcode pre { margin: 0em; }  .csharpcode .rem { color: #008000; }  .csharpcode .kwrd { color: #0000ff; }  .csharpcode .str { color: #006080; }  .csharpcode .op { color: #0000c0; }  .csharpcode .preproc { color: #cc6633; }  .csharpcode .asp { background-color: #ffff00; }  .csharpcode .html { color: #800000; }  .csharpcode .attr { color: #ff0000; }  .csharpcode .alt   {  	background-color: #f4f4f4;  	width: 100%;  	margin: 0em;  }  .csharpcode .lnum { color: #606060; }</style>
<p>As you can see, has created a new &#8216;virtual&#8217; column named &#8216;Row&#8217; and filled it with sequential row numbers. Breaking this query down, we can see what each individual part does:</p>
<p><strong>SELECT CallID</strong> : Returns the data from the CallID Column from my table<br />
<strong>ROW_NUMBER()</strong> : Works the magic to return a row number<br />
<strong>OVER (ORDER BY ID)</strong> : This determines the order of the data that is returned BEFORE the row number is added<br />
<strong>AS Row</strong> : gives the column generated by &#8216;ROW_NUMBER() OVER (ORDER BY ID)&#8217; the name &#8216;Row&#8217;<br />
<strong>FROM CallRecords</strong> : Get the data from my CallRecords tables</p>
<p>Now let&#8217;s expand this query to return just the rows between 5 and 9 by wrapping it in a bit of extra SQL:</p>
<pre class="csharpcode">SELECT CallID, Row FROM
( SELECT CallID, (ROW_NUMBER() OVER (ORDER BY ID))
AS Row FROM calldatarecords ) Rows
WHERE Row BETWEEN 5 and 9</pre>
<style type="text/css">                .csharpcode, .csharpcode pre  {  	font-size: small;  	color: black;  	font-family: consolas, "Courier New", courier, monospace;  	background-color: #ffffff;  	/*white-space: pre;*/  }  .csharpcode pre { margin: 0em; }  .csharpcode .rem { color: #008000; }  .csharpcode .kwrd { color: #0000ff; }  .csharpcode .str { color: #006080; }  .csharpcode .op { color: #0000c0; }  .csharpcode .preproc { color: #cc6633; }  .csharpcode .asp { background-color: #ffff00; }  .csharpcode .html { color: #800000; }  .csharpcode .attr { color: #ff0000; }  .csharpcode .alt   {  	background-color: #f4f4f4;  	width: 100%;  	margin: 0em;  }  .csharpcode .lnum { color: #606060; }</style>
<p>And that&#8217;s it! Have fun!</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http://www.j-dee.com/2007/08/08/efficient-data-paging-with-sql-server-2005-using-row_number/"><img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.j-dee.com/2007/08/08/efficient-data-paging-with-sql-server-2005-using-row_number/" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.j-dee.com/2007/08/08/efficient-data-paging-with-sql-server-2005-using-row_number/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

