<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Sajithpremachandran&#039;s Blog</title>
	<atom:link href="http://sajithpremachandran.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sajithpremachandran.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 04 May 2011 05:53:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sajithpremachandran.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/f7b009dc4b26ac417b35d2acfe800df5?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Sajithpremachandran&#039;s Blog</title>
		<link>http://sajithpremachandran.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sajithpremachandran.wordpress.com/osd.xml" title="Sajithpremachandran&#039;s Blog" />
	<atom:link rel='hub' href='http://sajithpremachandran.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Generating the Text File using Stored Procedure</title>
		<link>http://sajithpremachandran.wordpress.com/2011/05/04/generating-the-text-file-using-stored-procedure/</link>
		<comments>http://sajithpremachandran.wordpress.com/2011/05/04/generating-the-text-file-using-stored-procedure/#comments</comments>
		<pubDate>Wed, 04 May 2011 05:53:52 +0000</pubDate>
		<dc:creator>sajithpremachandran</dc:creator>
		
		<guid isPermaLink="false">http://sajithpremachandran.wordpress.com/?p=45</guid>
		<description><![CDATA[BEGIN TRY IF (OBJECT_ID(&#8216;tempdb..##tbReferenceDataTemp&#8217;) IS NULL) BEGIN &#8211;This table is to hold the Reference data CREATE TABLE [##tbReferenceDataTemp] ( [AccountAbbrv] [VARCHAR](100) NULL, [CountryAbbrv] [VARCHAR](100) NULL, [OCC] [VARCHAR](5) NULL, [Region] [VARCHAR](100) NULL ) END INSERT INTO [##tbReferenceDataTemp] SELECT wcs.[Account Abbreviation],wcs.[Country Abbreviation],wcs.[OCC Code],wcs.[Account Region] FROM wcs select @sql = &#8216;bcp ##tbReferenceDataTemp out c:\Details.txt -c -t, -r&#8221;\n&#8221; -T [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=45&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>BEGIN TRY<br />
IF (OBJECT_ID(&#8216;tempdb..##tbReferenceDataTemp&#8217;) IS NULL)<br />
BEGIN<br />
&#8211;This table is to hold the Reference data</p>
<p>CREATE TABLE [##tbReferenceDataTemp]<br />
(<br />
[AccountAbbrv] [VARCHAR](100) NULL,<br />
[CountryAbbrv] [VARCHAR](100) NULL,<br />
[OCC] [VARCHAR](5) NULL,<br />
[Region] [VARCHAR](100) NULL<br />
)<br />
END</p>
<p>INSERT INTO [##tbReferenceDataTemp] </p>
<p>SELECT wcs.[Account Abbreviation],wcs.[Country Abbreviation],wcs.[OCC Code],wcs.[Account Region] FROM wcs</p>
<p>select @sql = &#8216;bcp ##tbReferenceDataTemp out c:\Details.txt -c -t, -r&#8221;\n&#8221; -T -S&#8217; + @@servername<br />
exec master..xp_cmdshell @sql </p>
<p>&#8211;Rowcount Details<br />
SELECT @ROWCOUNT=COUNT(1) FROM ##tbReferenceDataTemp<br />
SET @ROWCOUNT=@ROWCOUNT+2<br />
SET @RowcountDetails=@ROWCOUNT</p>
<p>&#8211;Transmission Date<br />
SELECT @Transmissiondate=CONVERT(VARCHAR(10),GETDATE(),112)<br />
SELECT @Header=&#8217;echo&#8217;+&#8217; H,&#8217;+'Txt,&#8217;+@Transmissiondate+&#8217; &gt;&gt; c:\Header.txt&#8217;<br />
exec master..xp_cmdshell @Header</p>
<p>&#8211;Filename creation<br />
SET @FileName=&#8217;ATT_ISTARS_WCS_REFDATA_&#8217;+@Transmissiondate+&#8217;.TXT&#8217;</p>
<p>&#8211;Trailer Information<br />
SELECT @Trailer=&#8217;echo&#8217;+&#8217; TRAILER,&#8217;+@RowcountDetails+&#8217; &gt;&gt; c:\&#8217;+@FileName</p>
<p>&#8211;Copy the Header information to Details information<br />
SELECT @Copyfile=&#8217;copy /Y c:\Header.txt + c:\Details.txt &#8216;+&#8217;C:\&#8217;+@FileName</p>
<p>exec master..xp_cmdshell @Copyfile<br />
exec master..xp_cmdshell @Trailer</p>
<p>&#8211;Deleting the Temporary files<br />
exec master..xp_cmdshell &#8216;del c:\Details.txt&#8217;<br />
exec master..xp_cmdshell &#8216;del c:\Header.txt&#8217; </p>
<p>drop table ##tbReferenceDataTemp<br />
END TRY<br />
BEGIN CATCH</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sajithpremachandran.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sajithpremachandran.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sajithpremachandran.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sajithpremachandran.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sajithpremachandran.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sajithpremachandran.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sajithpremachandran.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sajithpremachandran.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sajithpremachandran.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sajithpremachandran.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sajithpremachandran.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sajithpremachandran.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sajithpremachandran.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sajithpremachandran.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=45&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sajithpremachandran.wordpress.com/2011/05/04/generating-the-text-file-using-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a6bb2faa7ebac9f0ad17bdb911627005?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jithu</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER – Introduction to CLR – Simple Example of CLR Stored Procedure</title>
		<link>http://sajithpremachandran.wordpress.com/2010/08/11/sql-server-%e2%80%93-introduction-to-clr-%e2%80%93-simple-example-of-clr-stored-procedure/</link>
		<comments>http://sajithpremachandran.wordpress.com/2010/08/11/sql-server-%e2%80%93-introduction-to-clr-%e2%80%93-simple-example-of-clr-stored-procedure/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 04:27:02 +0000</pubDate>
		<dc:creator>sajithpremachandran</dc:creator>
		
		<guid isPermaLink="false">http://sajithpremachandran.wordpress.com/?p=42</guid>
		<description><![CDATA[CLR is abbreviation of Common Language Runtime. In SQL Server 2005 and later version of it database objects can be created which are created in CLR. Stored Procedures, Functions, Triggers can be coded in CLR. CLR is faster than T-SQL in many cases. CLR is mainly used to accomplish task which are not possible by [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=42&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>CLR is abbreviation of Common Language Runtime. In SQL Server 2005 and later version of it database objects can be created which are created in CLR. Stored Procedures, Functions, Triggers can be coded in CLR. CLR is faster than T-SQL in many cases. CLR is mainly used to accomplish task which are not possible by T-SQL or can use lots of resources. CLR can be usually implemented where there is intense string operation, thread management or iteration methods which can be complicated for T-SQL. Implementing CLR provides more security to Extended Stored Procedure.</p>
<p>Let us create one very simple CLR where we will print current system datetime.</p>
<p>1) Open Microsoft Visual Studio &gt;&gt; Click New Project &gt;&gt; Select Visual C# &gt;&gt; Database &gt;&gt; SQL Server Project</p>
<p>2) Either choose from existing database connection as reference or click on Add New Reference. In my example I have selected Add New Reference<br />
3) If you have selected existing reference skip to next step or add database reference as displayed in image.<br />
4) Once database reference is added following project will be displayed in Solution Explorer. Right click on Solution Explorer &gt;&gt; Click on Add &gt;&gt; Stored Procedure.<br />
5) Add new stored procedure template from following screen.<br />
6) Once template added it will look like following image.<br />
7) Now where it suggest to //Put your code here. Replace it with code displayed in the image. Once the code is complete do following two steps.<br />
a) Click on menu bar &gt;&gt; Build &gt;&gt; Build ProjectName<br />
b) Click on menu bar &gt;&gt; Build &gt;&gt; Deploy ProjectName<br />
Building and Deploying project should give successful message</p>
<p>using System;<br />
using System.Data;<br />
using System.Data.SqlClient;<br />
using System.Data.SqlTypes;<br />
using Microsoft.SqlServer.Server;</p>
<p>public partial class StoredProcedures<br />
{<br />
[Microsoft.SqlServer.Server.SqlProcedure]<br />
public static void CLRSPTest()<br />
{<br />
SqlPipe sp;<br />
sp = SqlContext.Pipe;<br />
String strCurrentTime = “Current System DateTime is: “<br />
+ System.DateTime.Now.ToString();<br />
sp.Send(strCurrentTime);<br />
}<br />
};<br />
 <img src='http://s2.wp.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> Now open SQL Server Management Studio and run following script in Query Editor. It should return current system datetime. Running it again the time will change.<br />
USE AdventureWorks<br />
GO<br />
EXEC dbo.CLRSPTest<br />
GO </p>
<p>Reference : Pinal Dave (http://blog.SQLAuthority.com)</p>
<p>http://blog.sqlauthority.com/2008/10/19/sql-server-introduction-to-clr-simple-example-of-clr-stored-procedure/</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sajithpremachandran.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sajithpremachandran.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sajithpremachandran.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sajithpremachandran.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sajithpremachandran.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sajithpremachandran.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sajithpremachandran.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sajithpremachandran.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sajithpremachandran.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sajithpremachandran.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sajithpremachandran.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sajithpremachandran.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sajithpremachandran.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sajithpremachandran.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=42&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sajithpremachandran.wordpress.com/2010/08/11/sql-server-%e2%80%93-introduction-to-clr-%e2%80%93-simple-example-of-clr-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a6bb2faa7ebac9f0ad17bdb911627005?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jithu</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.NET AJAX Performance Improvement</title>
		<link>http://sajithpremachandran.wordpress.com/2010/08/11/asp-net-ajax-performance-improvement/</link>
		<comments>http://sajithpremachandran.wordpress.com/2010/08/11/asp-net-ajax-performance-improvement/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 04:22:28 +0000</pubDate>
		<dc:creator>sajithpremachandran</dc:creator>
		
		<guid isPermaLink="false">http://sajithpremachandran.wordpress.com/?p=39</guid>
		<description><![CDATA[I would like to introduce two useful tools for our Performance Analysis: 1. HttpWatch to show the network traffic. Here’s how the network traffic looked before any optimization: And we can see there are totally 22 requests and spend 9 seconds to get the 654k result. It is a really terrible in performance. 2. ScriptReferenceProfiler [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=39&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I would like to introduce two useful tools for our Performance Analysis:</p>
<p>1. HttpWatch to show the network traffic.<br />
Here’s how the network traffic looked before any optimization:</p>
<p>And we can see there are totally 22 requests and spend 9 seconds to get the 654k result. It is a really terrible in performance.<br />
2. ScriptReferenceProfiler to show the JavaScript reference.<br />
ScriptReferenceProfiler is an open source tool on CodePlex, for analysis the JavaScript references of ASP.NET AJAX, we can simply add the following code to our page in order to show the JavaScript references imported by ScriptManager.</p>
<p>We can see, before any optimization, there are 17 references found on this page, include the Microsoft Ajax Core runtime, asynchronous postback scripts, Ajax Control Toolkit Extender scripts and so on:</p>
<p>Optimization in web.config<br />
To optimize the ASP.NET AJAX in our web application, first of all, we need to make sure the Compression and Caching is enabled in our web.config:</p>
<p>1. Enable The Caching:<br />
We know, in the development of web application, enable the caching is a must operation. To enable the caching of ASP.NET AJAX, we need make sure the enableCaching property of scriptResourceHandler is set to true.</p>
<p>As our expected, the page response more quickly in the second time, the expend time is coming from 12.862 seconds down to 0.409seconds; and the received size from server decrease from 692K to 14K.</p>
<p>2. Enable The Compression:<br />
The Caching will saving almost 95% of the network traffic in the second time we request the page, however, the first page request still ask for a huge data from server. How to reduce the first request? don’t worry, set enableCompression property of scriptResourceHandler to true will help:</p>
<p>As we can see in the screen shot, many script files are getting smaller. and the total size decrease form 692K to 183K, about 1/4 compare to before.</p>
<p>♣Note: The compression is not work in Internet Explorer 6.0, because there is an known bug in IE 6, that cause the mistake might be occur when receiving the Gzip header. So the develop team close all the compression ability in IE 6.</p>
<p>Optimization in ScriptManager<br />
The ScriptManager control manages client script for AJAX-enabled ASP.NET Web pages. By default, the ScriptManager control registers the script for the Microsoft AJAX Library with the page. This enables client script to use the type system extensions and to support features such as partial-page rendering and Web-service calls. Following, we need to setting the property of ScriptManager to optimize the performance of ASP.NET AJAX.</p>
<p>1. ScriptMode for Release<br />
In one of Scott Guthrie’s post, he explain that we should avoid when deploying an ASP.NET application into production  leave the  switch on within the application’s web.config file.</p>
<p>It will cause:</p>
<p>1) The compilation of ASP.NET pages takes longer (since some batch optimizations are disabled)</p>
<p>2) Code can execute slower (since some additional debug paths are enabled)</p>
<p>3) Much more memory is used within the application at runtime</p>
<p>4) Scripts and images downloaded from the WebResources.axd handler are not cached</p>
<p>In this scenario, we can set the ScriptManager on the page run into the release mode to like the following:</p>
<p>2. EnablePartialRendering Yes or No?<br />
There is another property in ScriptManager named EnablePartialRendering,  it gets or sets a value that enables partial rendering of a page, which in turn enables you to update regions of the page individually by using UpdatePanel controls.</p>
<p>So, if we using the UpdatePanel in the page, we must set this property to true, conversely, if the UpdatePanel is not using in our page, it would be better that we set the EnablePartialRendering to false.</p>
<p>That will cause the unnecessary file “MicrosoftAjaxWebForm.js”, which is used to the partial rendering not import to our page.</p>
<p>3. LoadScriptBeforeUI<br />
ScriptManager control has LoadScriptsBeforeUI property which we can set to “False” in order to postpone several script downloads after the content is downloaded and shown. This adds the script references end of the  tag. As a result, we will see the content first and then the additional scripts, exteders, AJAX Control Toolkit scripts get downloaded and initialized.</p>
<p>This will make the page show quikly, and provide a better User Experience.</p>
<p>Script Combining<br />
In the previous talk, we can see the download size is coming down, but the number of requests is still more than 20</p>
<p>1. ToolkitScriptManager<br />
There is a ToolkitScriptManager control in the AJAX Control Toolkit, we can replace the default  control with this, it supports the ability to dynamically merge multiple client-side Javascript scripts into a single file that is downloaded to the client at runtime.  Better yet, only the Javascript needed by the specific controls on the page are included within the combined download, to make it as small as possible.</p>
<p>As the screen shot shows, It is a big savings in requests &#8211;  we now get one request for Toolkit scripts instead of 12.  In this scenario, we also got about a 50% download speed improvement by only having one request.</p>
<p>2. CompositeScript<br />
If you are using ASP.NET 3.5 with SP1, there is a more powerful tool to combining the Script file – CompositeScript.</p>
<p>First, We can use the ScriptReferenceProfiler to show the JavaScript references</p>
<p>and then, we can add  and  elements as children of the ScriptManager control.</p>
<p>Then, Copy the script references from the page and paste them into the  element inside the ScriptManager control, the result mark up is following:</p>
<p>Run the page and view the traffic. We will see just one script reference now instead of all the script inside the  element</p>
<p>Taken from:</p>
<p>http://lancezhang.wordpress.com/2008/11/15/aspnet-ajax-performance/</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sajithpremachandran.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sajithpremachandran.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sajithpremachandran.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sajithpremachandran.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sajithpremachandran.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sajithpremachandran.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sajithpremachandran.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sajithpremachandran.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sajithpremachandran.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sajithpremachandran.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sajithpremachandran.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sajithpremachandran.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sajithpremachandran.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sajithpremachandran.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=39&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sajithpremachandran.wordpress.com/2010/08/11/asp-net-ajax-performance-improvement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a6bb2faa7ebac9f0ad17bdb911627005?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jithu</media:title>
		</media:content>
	</item>
		<item>
		<title>Accessing REST based Web services using SQL CLR</title>
		<link>http://sajithpremachandran.wordpress.com/2010/08/11/accessing-rest-based-web-services-using-sql-clr/</link>
		<comments>http://sajithpremachandran.wordpress.com/2010/08/11/accessing-rest-based-web-services-using-sql-clr/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 04:13:29 +0000</pubDate>
		<dc:creator>sajithpremachandran</dc:creator>
		
		<guid isPermaLink="false">http://sajithpremachandran.wordpress.com/?p=35</guid>
		<description><![CDATA[What is REST web service? REST can be described as an architecture style. The acronym REST stands for ‘Representational State Transfer’, this means that every unique URI is representation of some object and you can get the content of this object using HTTP GET as well as you can use POST, PUT and DELETE to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=35&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>What is REST web service?</p>
<p>REST can be described as an architecture style. The acronym REST stands for ‘Representational State Transfer’, this means that  every unique URI is representation of some object and you can get the content of this object using HTTP GET as well as you can use POST, PUT and DELETE to play with content of this object.</p>
<p>REST &#8211; An Architecture style, not a standard</p>
<p>This is really good to know that REST is not a standard as you will not see any W3C standards putting any REST specifications. The reason is that REST is simply an architecture style, you can’t pack a toolkit of this; instead you can use this style during writing your web services.  Though REST is an architecture style but it use certain standards like:</p>
<p>·         HTTP</p>
<p>·         text/xml, text/html, etc (MIME types)</p>
<p>·         URL<br />
How to Call REST Web Service using SQL CLR</p>
<p>REST based web services are most of the time in form of URI, to consume these web services one has to write SQL CLR stored procedures. I have taken an example to make standard PUT and POST calls to REST based web services, this code can be used to practically make call to any REST web services that have PUT or POST payload. Below code snippet describes .NET code written to make CLR stored procedures</p>
<p>using System;</p>
<p>using System.Data;</p>
<p>using System.Data.SqlClient;</p>
<p>using System.Data.SqlTypes;</p>
<p>using Microsoft.SqlServer.Server;</p>
<p>using System.Net;</p>
<p>using System.IO;</p>
<p>public partial class StoredProcedures</p>
<p>{</p>
<p>    [Microsoft.SqlServer.Server.SqlProcedure]</p>
<p>    public static void SampleWSPut(SqlString weburl, out SqlString returnval)</p>
<p>    {</p>
<p>        string url = Convert.ToString(weburl);</p>
<p>        string feedData=string.Empty;</p>
<p>        try</p>
<p>        {</p>
<p>            HttpWebRequest request = null;</p>
<p>            HttpWebResponse response = null;</p>
<p>            Stream stream = null;</p>
<p>            StreamReader streamReader = null;</p>
<p>            request = (HttpWebRequest)WebRequest.Create(url);</p>
<p>            request.Method = &#8220;PUT&#8221;; // you have to change to</p>
<p>            //PUT/POST/GET/DELETE based on your scenerio…</p>
<p>            request.ContentLength = 0;</p>
<p>            response = (HttpWebResponse)request.GetResponse();</p>
<p>            stream = response.GetResponseStream();</p>
<p>            streamReader = new StreamReader(stream);</p>
<p>            feedData = streamReader.ReadToEnd();</p>
<p>            response.Close();</p>
<p>            stream.Dispose();</p>
<p>            streamReader.Dispose();</p>
<p>        }</p>
<p>        catch (Exception ex)</p>
<p>        {</p>
<p>            SqlContext.Pipe.Send(ex.Message.ToString());</p>
<p>        }</p>
<p>              returnval = feedData;</p>
<p>    }</p>
<p>    [Microsoft.SqlServer.Server.SqlProcedure]</p>
<p>    public static void SampleWSPost(SqlString weburl, out SqlString returnval)</p>
<p>    {</p>
<p>        string url = Convert.ToString(weburl);</p>
<p>        string feedData = string.Empty;</p>
<p>        try</p>
<p>        {</p>
<p>            HttpWebRequest request = null;</p>
<p>            HttpWebResponse response = null;</p>
<p>            Stream stream = null;</p>
<p>            StreamReader streamReader = null;</p>
<p>            request = (HttpWebRequest)WebRequest.Create(url);</p>
<p>            request.Method = &#8220;POST&#8221;;</p>
<p>            response = (HttpWebResponse)request.GetResponse();</p>
<p>            stream = response.GetResponseStream();</p>
<p>            streamReader = new StreamReader(stream);</p>
<p>            feedData = streamReader.ReadToEnd();</p>
<p>            response.Close();</p>
<p>            stream.Dispose();</p>
<p>            streamReader.Dispose();</p>
<p>        }</p>
<p>        catch (Exception ex)</p>
<p>        {</p>
<p>            SqlContext.Pipe.Send(ex.Message.ToString());</p>
<p>        }</p>
<p>        returnval = feedData;</p>
<p>    }</p>
<p>};</p>
<p>The above code depicts that we have used HttpWebRequest class object to create an URI based request, and later we have defined the type of method to make this URI calls, that is ‘PUT’ and ‘POST’. You can change this method based on your payload request.</p>
<p>When the above code will be compiled in assembly and later registered as an assembly in SQL Server, we’ll create two CLR stored procedures to bind assembly stored procedure methods with them.</p>
<p>Generate Assembly and Register in SQL Server</p>
<p>The code here guide you to create assembly of class and later register this assembly in SQL Server</p>
<p>¾  Generate Assembly</p>
<p>// Creates StoredProcedures.dll</p>
<p>csc /t:library StoredProcedures.cs</p>
<p>¾  Register Assembly in SQL Server</p>
<p>USE [SampleDB]</p>
<p>GO</p>
<p>CREATE ASSEMBLY SPAssembly</p>
<p>FROM &#8216;C:\SampleCLRSP\StoredProcedures.dll&#8217;</p>
<p>WITH PERMISSION_SET = UNSAFE;</p>
<p>GO</p>
<p>Create CLR Stored Procedure</p>
<p>I have put the T-SQL scripts here to create your CLR stored procedure to make call to any REST web service for PUT and POST payload</p>
<p>USE [SampleDB]</p>
<p>GO</p>
<p>/****** Object:  StoredProcedure [dbo].[SampleWSPut]    Script Date: 06/18/2008 06:02:32 ******/</p>
<p>CREATE PROCEDURE [dbo].[SampleWSPut]</p>
<p>      @weburl [nvarchar](4000),</p>
<p>      @returnval [nvarchar](2000) OUTPUT</p>
<p>WITH EXECUTE AS CALLER</p>
<p>AS</p>
<p>EXTERNAL NAME [SPAssembly].[StoredProcedures].[SampleWSPut]</p>
<p>GO</p>
<p>/****** Object:  StoredProcedure [dbo].[SampleWSPost]    Script Date: 06/18/2008 06:02:19 ******/</p>
<p>CREATE PROCEDURE [dbo].[SampleWSPost]</p>
<p>      @weburl [nvarchar](4000),</p>
<p>      @returnval [nvarchar](2000) OUTPUT</p>
<p>WITH EXECUTE AS CALLER</p>
<p>AS</p>
<p>EXTERNAL NAME [SPAssembly].[StoredProcedures].[SampleWSPost]</p>
<p>Calling CLR stored procedures</p>
<p>Below example shows that how can you make call to REST based web services using CLR stored procedures. CLR stored procedures written by us make call to REST web service and collect the response send by them, response could be a simple HTTP response message, for example 100, 200, 401 etc. or it could be full XML or MIME message returned to your application.</p>
<p>Declare @Response NVARCHAR(2000)</p>
<p>EXECUTE SampleWSPOST &#8216;http://sampledev03/wcfweb/calendarWS.svc/?appid=MMM&amp;AuctionCode=ABC&amp;months=4&#8242;,@Response OUT</p>
<p>SELECT @Response</p>
<p>GO</p>
<p>Declare @Response NVARCHAR(2000)</p>
<p>EXECUTE SampleWSPUT &#8216;http://sampledev03/wcfweb/calendarWS.svc/?appid=MMM&amp;AuctionCode=ABC&amp;months=4&#8242;,@Response OUT</p>
<p>SELECT @Response</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sajithpremachandran.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sajithpremachandran.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sajithpremachandran.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sajithpremachandran.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sajithpremachandran.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sajithpremachandran.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sajithpremachandran.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sajithpremachandran.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sajithpremachandran.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sajithpremachandran.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sajithpremachandran.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sajithpremachandran.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sajithpremachandran.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sajithpremachandran.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=35&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sajithpremachandran.wordpress.com/2010/08/11/accessing-rest-based-web-services-using-sql-clr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a6bb2faa7ebac9f0ad17bdb911627005?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jithu</media:title>
		</media:content>
	</item>
		<item>
		<title>Lambdaexpressions</title>
		<link>http://sajithpremachandran.wordpress.com/2010/08/04/lambdaexpressions/</link>
		<comments>http://sajithpremachandran.wordpress.com/2010/08/04/lambdaexpressions/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 05:50:48 +0000</pubDate>
		<dc:creator>sajithpremachandran</dc:creator>
		
		<guid isPermaLink="false">http://sajithpremachandran.wordpress.com/?p=32</guid>
		<description><![CDATA[http://blogs.msdn.com/b/ericwhite/archive/2006/10/03/lambda-expressions.aspx<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=32&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>http://blogs.msdn.com/b/ericwhite/archive/2006/10/03/lambda-expressions.aspx</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sajithpremachandran.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sajithpremachandran.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sajithpremachandran.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sajithpremachandran.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sajithpremachandran.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sajithpremachandran.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sajithpremachandran.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sajithpremachandran.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sajithpremachandran.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sajithpremachandran.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sajithpremachandran.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sajithpremachandran.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sajithpremachandran.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sajithpremachandran.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=32&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sajithpremachandran.wordpress.com/2010/08/04/lambdaexpressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a6bb2faa7ebac9f0ad17bdb911627005?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jithu</media:title>
		</media:content>
	</item>
		<item>
		<title>Optimize WebResource.axd and ScriptResource.axd</title>
		<link>http://sajithpremachandran.wordpress.com/2010/08/04/optimize-webresource-axd-and-scriptresource-axd/</link>
		<comments>http://sajithpremachandran.wordpress.com/2010/08/04/optimize-webresource-axd-and-scriptresource-axd/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 05:49:43 +0000</pubDate>
		<dc:creator>sajithpremachandran</dc:creator>
		
		<guid isPermaLink="false">http://sajithpremachandran.wordpress.com/?p=29</guid>
		<description><![CDATA[http://madskristensen.net/post/Optimize-WebResourceaxd-and-ScriptResourceaxd.aspx<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=29&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>http://madskristensen.net/post/Optimize-WebResourceaxd-and-ScriptResourceaxd.aspx</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sajithpremachandran.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sajithpremachandran.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sajithpremachandran.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sajithpremachandran.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sajithpremachandran.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sajithpremachandran.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sajithpremachandran.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sajithpremachandran.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sajithpremachandran.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sajithpremachandran.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sajithpremachandran.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sajithpremachandran.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sajithpremachandran.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sajithpremachandran.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=29&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sajithpremachandran.wordpress.com/2010/08/04/optimize-webresource-axd-and-scriptresource-axd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a6bb2faa7ebac9f0ad17bdb911627005?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jithu</media:title>
		</media:content>
	</item>
		<item>
		<title>Explain the access specifiers Public, Private, Protected, Friend, Internal, Default</title>
		<link>http://sajithpremachandran.wordpress.com/2010/01/18/explain-the-access-specifiers-public-private-protected-friend-internal-default/</link>
		<comments>http://sajithpremachandran.wordpress.com/2010/01/18/explain-the-access-specifiers-public-private-protected-friend-internal-default/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 06:20:59 +0000</pubDate>
		<dc:creator>sajithpremachandran</dc:creator>
				<category><![CDATA[1]]></category>

		<guid isPermaLink="false">http://sajithpremachandran.wordpress.com/2010/01/18/explain-the-access-specifiers-public-private-protected-friend-internal-default/</guid>
		<description><![CDATA[The main purpose of using access specifiers is to provide security to the applications. The availability (scope) of the member objects of a class may be controlled using access specifiers. 1. PUBLIC As the name specifies, it can be accessed from anywhere. If a member of a class is defined as public then it can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=27&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>The main purpose of using access specifiers is to provide security to the applications. The availability (scope) of the member objects of a class may be controlled using access specifiers. </p>
<p>1. PUBLIC<br />
As the name specifies, it can be accessed from anywhere. If a member of a class is defined as public then it can be accessed anywhere in the class as well as outside the class. This means that objects can access and modify public fields, properties, methods.</p>
<p>2. PRIVATE<br />
As the name suggests, it can&#8217;t be accessed outside the class. Its the private property of the class and can be accessed only by the members of the class. </p>
<p>3. FRIEND/INTERNAL<br />
Friend &amp; Internal mean the same. Friend is used in VB.NET. Internal is used in C#. Friends can be accessed by all classes within an assembly but not from outside the assembly. </p>
<p>4. PROTECTED<br />
Protected variables can be used within the class as well as the classes that inherites this class. </p>
<p>5. PROTECTED FRIEND/PROTECTED INTERNAL<br />
The Protected Friend can be accessed by Members of the Assembly or the inheriting class, and ofcourse, within the class itself. </p>
<p>6. DEFAULT<br />
A Default property is a single property of a class that can be set as the default. This allows developers that use your class to work more easily with your The main purpose of using access specifiers is to provide security to the applications. The availability (scope) of the member objects of a class may be controlled using access specifiers. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sajithpremachandran.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sajithpremachandran.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sajithpremachandran.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sajithpremachandran.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sajithpremachandran.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sajithpremachandran.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sajithpremachandran.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sajithpremachandran.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sajithpremachandran.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sajithpremachandran.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sajithpremachandran.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sajithpremachandran.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sajithpremachandran.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sajithpremachandran.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=27&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sajithpremachandran.wordpress.com/2010/01/18/explain-the-access-specifiers-public-private-protected-friend-internal-default/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a6bb2faa7ebac9f0ad17bdb911627005?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jithu</media:title>
		</media:content>
	</item>
		<item>
		<title>Difference between Clustered and Non Clustered Index in SQL Server 2005</title>
		<link>http://sajithpremachandran.wordpress.com/2009/12/17/difference-between-clustered-and-non-clustered-index-in-sql-server-2005/</link>
		<comments>http://sajithpremachandran.wordpress.com/2009/12/17/difference-between-clustered-and-non-clustered-index-in-sql-server-2005/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 18:01:33 +0000</pubDate>
		<dc:creator>sajithpremachandran</dc:creator>
				<category><![CDATA[Sql Server]]></category>

		<guid isPermaLink="false">http://sajithpremachandran.wordpress.com/?p=22</guid>
		<description><![CDATA[Difference between Clustered and Non Clustered Index in SQL Server 2005   Clustered Index Leaf node contains the actual data pages. The data row of the table are sorted and stored in the table based on their clustered index key (i.e. based on the index column(s)). You can have only one clustered index per table. The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=22&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Difference between Clustered and Non Clustered Index in SQL Server 2005</h2>
<p><a href="http://shahharsh.wordpress.com/2009/05/16/difference-between-clustered-and-non-clustered-index-in-sql-server-2005/#comments"></a> </p>
<p><strong><span style="text-decoration:underline;">Clustered Index</span></strong></p>
<ol>
<li>Leaf node contains the actual data pages.</li>
<li>The data row of the table are sorted and stored in the table based on their clustered index key (i.e. based on the index column(s)).</li>
<li>You can have only one clustered index per table.</li>
<li>The RowLocator in Clustered Index is the clustered Index key.</li>
</ol>
<p><strong><span style="text-decoration:underline;">Non Clustered Index</span></strong></p>
<ol>
<li>Leaf node contains index pages instead of data pages.</li>
<li>You can have up to 249 Non Clustered Index per table.</li>
<li>The data row of the table are not sorted and stored in the table based on their clustered index key (i.e. based on the index column(s)).</li>
<li>The row locator in Non Clustered Index is a pointer to the row. Row locator is built based on the following.<br />
<strong>ROW ID (RowLocator)= file identifier + page number + row number on the page</strong></li>
<li>You can have the functionality of Non key Columns (Included Columns) in case of Non Clustered Index.</li>
<li>Non key columns are stored only at the leaf level whereas Key columns (Non Clustered Index Key columns) are stored at all the levels of non clustered index.</li>
</ol>
<p><strong><span style="text-decoration:underline;">What are Heaps?</span></strong></p>
<ol>
<li>Heaps are tables without clustered index.</li>
<li>Data Rows are not stored in a particular order.</li>
<li>Sequences of the Data pages are not ordered as well as they are not linked in a linked list.</li>
</ol>
<p><strong><span style="text-decoration:underline;">Examples</span></strong></p>
<p><strong><span style="text-decoration:underline;">Clustered Index Example</span></strong></p>
<p>Clustered can be created in the following ways</p>
<ol>
<li>Create Table with Primary key – this will by default create clustered index based on the primary key defined.</li>
<li>Create clustered Index using the CREATE CLUSTERED INDEX command<strong>.</strong></li>
</ol>
<p>–create table with primary key<br />
CREATE TABLE Employee (empno NUMERIC (10) PRIMARY KEY, EmpName Varchar(10));</p>
<p>–check the existence of Index for the table</p>
<p>SELECT * FROM SYS.INDEXES WHERE OBJECT_ID = (SELECT OBJECT_ID FROM SYS.OBJECTS WHERE NAME=‘EMPLOYEE’); <br />
 </p>
<p><a href="http://shahharsh.files.wordpress.com/2009/05/image.png"></a></p>
<p>–create table without primary key</p>
<p>CREATE TABLE Employee2 (empno NUMERIC (10), EmpName Varchar(10));</p>
<p>–Create Clustered Index using Clustered Index  Command</p>
<p>CREATE CLUSTERED INDEX IDX_CLUST_EMP ON Employee2 (empno);</p>
<p>–check the existence of Index for the table</p>
<p>SELECT * FROM SYS.INDEXES WHERE OBJECT_ID = (SELECT OBJECT_ID FROM SYS.OBJECTS WHERE NAME=‘Employee2′);</p>
<p>     <a href="http://shahharsh.files.wordpress.com/2009/05/image1.png"></a></p>
<p><strong><span style="text-decoration:underline;"><br />
Non Clustered Index Example<br />
</span></strong><br />
– Adding a column the existing employee table</p>
<p>ALTER TABLE EMPLOYEE<br />
ADD TAX_ID NUMERIC(10);</p>
<p>–create non clustered index on TAX_ID column<br />
CREATE INDEX IDX_NON_CLUST ON EMPLOYEE (TAX_ID);</p>
<p>–check the existence of Index for the table<br />
SELECT * FROM SYS.INDEXES WHERE OBJECT_ID = (SELECT OBJECT_ID FROM SYS.OBJECTS WHERE NAME=‘EMPLOYEE’);</p>
<p><a href="http://shahharsh.files.wordpress.com/2009/05/image2.png"></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sajithpremachandran.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sajithpremachandran.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sajithpremachandran.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sajithpremachandran.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sajithpremachandran.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sajithpremachandran.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sajithpremachandran.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sajithpremachandran.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sajithpremachandran.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sajithpremachandran.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sajithpremachandran.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sajithpremachandran.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sajithpremachandran.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sajithpremachandran.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=22&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sajithpremachandran.wordpress.com/2009/12/17/difference-between-clustered-and-non-clustered-index-in-sql-server-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>0.000000 0.000000</georss:point>
		<geo:lat>0.000000</geo:lat>
		<geo:long>0.000000</geo:long>
		<media:content url="http://0.gravatar.com/avatar/a6bb2faa7ebac9f0ad17bdb911627005?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jithu</media:title>
		</media:content>
	</item>
		<item>
		<title>What is the difference between .Net Remoting and Asp.Net Web Services? •</title>
		<link>http://sajithpremachandran.wordpress.com/2009/12/12/what-is-the-difference-between-net-remoting-and-asp-net-web-services-%e2%80%a2/</link>
		<comments>http://sajithpremachandran.wordpress.com/2009/12/12/what-is-the-difference-between-net-remoting-and-asp-net-web-services-%e2%80%a2/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 08:58:55 +0000</pubDate>
		<dc:creator>sajithpremachandran</dc:creator>
				<category><![CDATA[Dot Net]]></category>

		<guid isPermaLink="false">http://sajithpremachandran.wordpress.com/2009/12/12/what-is-the-difference-between-net-remoting-and-asp-net-web-services-%e2%80%a2/</guid>
		<description><![CDATA[What is the difference between .Net Remoting and Asp.Net Web Services? • ASP.NET Web Services Can be accessed only over HTTP but .Net Remoting Can be accessed over various protocols like TCP, HTTP, SMTP etc. • Web Services are based on stateless service architecture but .Net Remoting support for both stateful and stateless environment. • Web Services support heterogeneous [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=21&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>What is the difference between .Net Remoting and Asp.Net Web Services? • ASP.NET Web Services Can be accessed only over HTTP but .Net Remoting Can be accessed over various protocols like TCP, HTTP, SMTP etc. • Web Services are based on stateless service architecture but .Net Remoting support for both stateful and stateless environment. • Web Services support heterogeneous environments means interoperability across platforms but .Net remoting requires .Net on both server and client end. • .NET Remoting provides the fast communication than Web Services when we use the TCP channel and the binary formatter. • Web services support only the objects that can be serialized but .NET Remoting can provide support to all objects that inherit MarshalByRefObject. • Web Services are reliable than .Net remoting because Web services are always hosted in IIS. • Web Services are ease to create and deploy but .Net remoting is bit complex to program.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sajithpremachandran.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sajithpremachandran.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sajithpremachandran.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sajithpremachandran.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sajithpremachandran.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sajithpremachandran.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sajithpremachandran.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sajithpremachandran.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sajithpremachandran.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sajithpremachandran.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sajithpremachandran.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sajithpremachandran.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sajithpremachandran.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sajithpremachandran.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=21&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sajithpremachandran.wordpress.com/2009/12/12/what-is-the-difference-between-net-remoting-and-asp-net-web-services-%e2%80%a2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>0.000000 0.000000</georss:point>
		<geo:lat>0.000000</geo:lat>
		<geo:long>0.000000</geo:long>
		<media:content url="http://0.gravatar.com/avatar/a6bb2faa7ebac9f0ad17bdb911627005?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jithu</media:title>
		</media:content>
	</item>
		<item>
		<title>What is a Strong Name in Microsoft.Net?</title>
		<link>http://sajithpremachandran.wordpress.com/2009/12/12/what-is-a-strong-name-in-microsoft-net/</link>
		<comments>http://sajithpremachandran.wordpress.com/2009/12/12/what-is-a-strong-name-in-microsoft-net/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 08:39:48 +0000</pubDate>
		<dc:creator>sajithpremachandran</dc:creator>
				<category><![CDATA[1]]></category>

		<guid isPermaLink="false">http://sajithpremachandran.wordpress.com/?p=14</guid>
		<description><![CDATA[What is a Strong Name in Microsoft.Net? In Microsoft.Net a strong name consists of the assembly&#8217;s identity. The strong name guarantees the integrity of the assembly. Strong Name includes the name of the .net assembly, version number, culture identity, and a public key token. It is generated from an assembly file using the corresponding private [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=14&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>What is a Strong Name in Microsoft.Net? In Microsoft.Net a strong name consists of the assembly&#8217;s identity. The strong name guarantees the integrity of the assembly. Strong Name includes the name of the .net assembly, version number, culture identity, and a public key token. It is generated from an assembly file using the corresponding private key. Steps to create strong named assembly: To create a strong named assembly you need to have a key pair (public key and a private key) file.</p>
<p>Use sn -k KeyFile.snk Open the dot net project to be complied as a strong named assembly. Open AssembyInfo.cs/ AssembyInfo.vb file. Add the following lines to AssemblyInfo file. [Assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("..\\..\\KeyFile.snk")] Compile the application, we have created a strong named assembly.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sajithpremachandran.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sajithpremachandran.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sajithpremachandran.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sajithpremachandran.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sajithpremachandran.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sajithpremachandran.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sajithpremachandran.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sajithpremachandran.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sajithpremachandran.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sajithpremachandran.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sajithpremachandran.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sajithpremachandran.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sajithpremachandran.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sajithpremachandran.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sajithpremachandran.wordpress.com&amp;blog=8875478&amp;post=14&amp;subd=sajithpremachandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sajithpremachandran.wordpress.com/2009/12/12/what-is-a-strong-name-in-microsoft-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>0.000000 0.000000</georss:point>
		<geo:lat>0.000000</geo:lat>
		<geo:long>0.000000</geo:long>
		<media:content url="http://0.gravatar.com/avatar/a6bb2faa7ebac9f0ad17bdb911627005?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jithu</media:title>
		</media:content>
	</item>
	</channel>
</rss>
