<?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>D-Blog &#187; SQL</title>
	<atom:link href="http://cubicthoughts.com/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://cubicthoughts.com</link>
	<description>just about anything...</description>
	<lastBuildDate>Tue, 29 Nov 2011 23:48:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Query to get the column names/types for all tables in SQL 2005</title>
		<link>http://cubicthoughts.com/2009/02/11/query-to-get-the-column-namestypes-for-all-tables-in-sql-2005/</link>
		<comments>http://cubicthoughts.com/2009/02/11/query-to-get-the-column-namestypes-for-all-tables-in-sql-2005/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 22:57:10 +0000</pubDate>
		<dc:creator>Deepak Vasa</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Sql Server 2005]]></category>
		<category><![CDATA[Sql Tricks]]></category>

		<guid isPermaLink="false">http://cubicthoughts.com/?p=106</guid>
		<description><![CDATA[SELECT schemas.name AS [Schema], tables.name AS [Table], columns.name AS [Column], CASE WHEN columns.system_type_id = 34 THEN &#8216;byte[]&#8216; WHEN columns.system_type_id = 35 THEN &#8216;string&#8217; WHEN columns.system_type_id = 36 THEN &#8216;System.Guid&#8217; WHEN columns.system_type_id = 48 THEN &#8216;byte&#8217; WHEN columns.system_type_id = 52 THEN &#8216;short&#8217; WHEN columns.system_type_id = 56 THEN &#8216;int&#8217; WHEN columns.system_type_id = 58 THEN &#8216;System.DateTime&#8217; WHEN columns.system_type_id [...]]]></description>
			<content:encoded><![CDATA[<p>SELECT schemas.name AS [Schema],<br />
tables.name AS [Table],<br />
columns.name AS [Column],<br />
CASE<br />
WHEN columns.system_type_id = 34 THEN &#8216;byte[]&#8216;<br />
WHEN columns.system_type_id = 35 THEN &#8216;string&#8217;<br />
WHEN columns.system_type_id = 36 THEN &#8216;System.Guid&#8217;<br />
WHEN columns.system_type_id = 48 THEN &#8216;byte&#8217;<br />
WHEN columns.system_type_id = 52 THEN &#8216;short&#8217;<br />
WHEN columns.system_type_id = 56 THEN &#8216;int&#8217;<br />
WHEN columns.system_type_id = 58 THEN &#8216;System.DateTime&#8217;<br />
WHEN columns.system_type_id = 59 THEN &#8216;float&#8217;<br />
WHEN columns.system_type_id = 60 THEN &#8216;decimal&#8217;<br />
WHEN columns.system_type_id = 61 THEN &#8216;System.DateTime&#8217;<br />
WHEN columns.system_type_id = 62 THEN &#8216;double&#8217;<br />
WHEN columns.system_type_id = 98 THEN &#8216;object&#8217;<br />
WHEN columns.system_type_id = 99 THEN &#8216;string&#8217;<br />
WHEN columns.system_type_id = 104 THEN &#8216;bool&#8217;<br />
WHEN columns.system_type_id = 106 THEN &#8216;decimal&#8217;<br />
WHEN columns.system_type_id = 108 THEN &#8216;decimal&#8217;<br />
WHEN columns.system_type_id = 122 THEN &#8216;decimal&#8217;<br />
WHEN columns.system_type_id = 127 THEN &#8216;long&#8217;<br />
WHEN columns.system_type_id = 165 THEN &#8216;byte[]&#8216;<br />
WHEN columns.system_type_id = 167 THEN &#8216;string&#8217;<br />
WHEN columns.system_type_id = 173 THEN &#8216;byte[]&#8216;<br />
WHEN columns.system_type_id = 175 THEN &#8216;string&#8217;<br />
WHEN columns.system_type_id = 189 THEN &#8216;long&#8217;<br />
WHEN columns.system_type_id = 231 THEN &#8216;string&#8217;<br />
WHEN columns.system_type_id = 239 THEN &#8216;string&#8217;<br />
WHEN columns.system_type_id = 241 THEN &#8216;string&#8217;<br />
WHEN columns.system_type_id = 241 THEN &#8216;string&#8217;<br />
END AS [Type],<br />
columns.is_nullable AS [Nullable]</p>
<p>FROM sys.tables tables<br />
INNER JOIN sys.schemas schemas ON (tables.schema_id = schemas.schema_id )<br />
INNER JOIN sys.columns columns ON (columns.object_id = tables.object_id)</p>
<p>WHERE tables.name <> &#8216;sysdiagrams&#8217;<br />
AND tables.name <> &#8216;dtproperties&#8217;</p>
<p>ORDER BY [Schema], [Table], [Column], [Type]</p>
Written by Deepak Vasa - <a href="http://www.cubicthoughts.com">Visit Website</a>]]></content:encoded>
			<wfw:commentRss>http://cubicthoughts.com/2009/02/11/query-to-get-the-column-namestypes-for-all-tables-in-sql-2005/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>LINQ to SQL &#8211; Not Dead</title>
		<link>http://cubicthoughts.com/2008/11/03/linq-to-sql-not-dead/</link>
		<comments>http://cubicthoughts.com/2008/11/03/linq-to-sql-not-dead/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 23:51:44 +0000</pubDate>
		<dc:creator>Deepak Vasa</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[L2S]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[Not Dead]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://cubicthoughts.com/?p=92</guid>
		<description><![CDATA[For those who are not aware, last week there has been some misunderstanding regarding the future of LINQ to SQL based on announcements made by MS at PDC. Well after reading a few blogs around the Blogosphere I have come accross the following posts which explain that there is future for L2S: Read Damien Guard&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>For those who are not aware, last week there has been some misunderstanding regarding the future of LINQ to SQL based on announcements made by MS at PDC. Well after reading a few blogs around the Blogosphere I have come accross the following posts which explain that there is future for L2S:</p>
<p>Read Damien Guard&#8217;s blog -&gt;<a title="Damien Guard" href="http://damieng.com/" target="_self">http://damieng.com/</a></p>
<p>Read Huagati&#8217;s Blog -&gt; <a title="Linq not dead" href="http://blog.huagati.com/res/index.php/2008/11/03/quiet-blog-gone-fishing-is-linq-to-sql-dead-etc/" target="_self">http://blog.huagati.com/res/index.php/2008/11/03/quiet-blog-gone-fishing-is-linq-to-sql-dead-etc/</a></p>
<p>Further I found this cool image supporing L2S <a title="Simon Segal" href="http://www.simonsegal.net/blog/" target="_self">here</a></p>
<div id="attachment_93" class="wp-caption alignnone" style="width: 203px"><a href="http://cubicthoughts.com/wp-content/uploads/2008/11/supportl2s.gif"><img class="size-medium wp-image-93" title="Support LINQ to SQL" src="http://cubicthoughts.com/wp-content/uploads/2008/11/supportl2s.gif" alt="Long live LINQ to SQL !!!" width="193" height="193" /></a><p class="wp-caption-text">Long live LINQ to SQL !!!</p></div>
Written by Deepak Vasa - <a href="http://www.cubicthoughts.com">Visit Website</a>]]></content:encoded>
			<wfw:commentRss>http://cubicthoughts.com/2008/11/03/linq-to-sql-not-dead/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server 2008 &#8211; my thoughts&#8230;.</title>
		<link>http://cubicthoughts.com/2008/08/12/sql-server-2008-my-thoughts/</link>
		<comments>http://cubicthoughts.com/2008/08/12/sql-server-2008-my-thoughts/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 13:30:55 +0000</pubDate>
		<dc:creator>Deepak Vasa</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[FileStreaming]]></category>
		<category><![CDATA[Filtered Indexing]]></category>
		<category><![CDATA[Merge Statements]]></category>
		<category><![CDATA[New Features]]></category>
		<category><![CDATA[Sparse columns]]></category>
		<category><![CDATA[SQL Server 2008]]></category>

		<guid isPermaLink="false">http://cubicthoughts.com/?p=60</guid>
		<description><![CDATA[I have been reading about SQL Server 2008 for a while and today I got a glimpse of the various features and how it can help developers at the Victoria Dot Net users group meeting. Thanks to the special presentation by Chris Hewitt &#8211; &#8220;What should developers know about SQL Server 2008?&#8221; A few days [...]]]></description>
			<content:encoded><![CDATA[<p>I have been reading about SQL Server 2008 for a while and today I got a glimpse of the various features and how it can help developers at the <a href="http://www.victoriadotnet.com.au" target="_blank">Victoria Dot Net</a> users group meeting. Thanks to the special presentation by <a href="http://endintiers.com/default.aspx" target="_blank">Chris Hewitt</a> &#8211; &#8220;What should developers know about SQL Server 2008?&#8221;</p>
<p>A few days ago, I read about the new &#8220;<strong>File Stream</strong>&#8221; data type and my initial thoughts were how would I use this new feature and where would this be more usefull, later I realised that I could use the FileStreaming data type to store all the various CSV reports that I generate from our various applications. So effectively instead of storing it on a file server and putting in the reference in SQL, I could easily store the entire CSV file in to SQL Server and let it worry about where and how it stores it. More over I can also have all the report metadata in one location (sweet <img src='http://cubicthoughts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>In the presentation Chris showed us a few examples on how we can send a <strong>Table as parameter</strong> to Stored Procedures and the new Merge Statement.  Well, frankly speaking it took me a few seconds to comprehend the huge benifits of sending in a table as a parameter to a stored procedure. The biggest benifit is the ability to insert large number of rows in one go by passing the data as a table parameter. Previously you could do that with temp tables but those tables were only specific to the stored procedure which creates them, however with this new feature we have some thing on the lines of Global Temp Tables. For more detailed explanation and examples, please refer this <a title="Passing table as parameter in stored procedures" href="http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1280004,00.html" target="_blank">article</a></p>
<p>Coming to the <strong>Merge statement</strong> that&#8217;s another cool feature that has huge number of benefits. In scenarios where you need to to insert, update, or delete data based on certain conditions, programmers have to take care of the actions in the application, however with Merge statements we can do the insert, update or delete in one single statement based on the join conditions. For more information, please refer this article at <a title="Merge Statement in Sql Server 2008" href="http://www.builderau.com.au/program/sqlserver/soa/Using-SQL-Server-2008-s-MERGE-statement/0,339028455,339283059,00.htm" target="_blank">BuilderAU</a>.</p>
<p>Another cool feature is the <strong>Filtered Indexing</strong>. As the name suggests, all it means is that when we create Indexes for a table in SQL Server 2008 based on a particular criteria (simple where clause). I am very keen to test this on one our biggest tables (9 million rows and counting). At the moment  it takes quite a bit of time to query this table for certain criteria, I would love to do some bench marking on this table and see how efficient the Filtered Indexes are.</p>
<p>Finally a one more interesting feature is the ability to Debug Sql Statements in the same way as .NET code. Chris showed how we could debug any SQL statement or Stored procedure, and also the MS has finally introduced Intellisense for SQL statements. Allthough I have been told that 3rd party tools have been providing SQL intellisense for quite some time now.</p>
<p>For those of you who are interested in other features like Sparse, new DateTime formats, new Convert functionality etc, please refer <a href="http://www.microsoft.com/sqlserver/2008/en/us/overview.aspx">SQL Server 2008 @ Microsoft</a>.</p>
Written by Deepak Vasa - <a href="http://www.cubicthoughts.com">Visit Website</a>]]></content:encoded>
			<wfw:commentRss>http://cubicthoughts.com/2008/08/12/sql-server-2008-my-thoughts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to convert ntext to nvarchar(max) in SQL 2005 &#8211; the right way</title>
		<link>http://cubicthoughts.com/2008/08/05/how-to-convert-ntext-to-nvarcharmax-in-sql-2005-the-right-way/</link>
		<comments>http://cubicthoughts.com/2008/08/05/how-to-convert-ntext-to-nvarcharmax-in-sql-2005-the-right-way/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 01:54:04 +0000</pubDate>
		<dc:creator>Deepak Vasa</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[ntext]]></category>
		<category><![CDATA[nvarchar(max)]]></category>
		<category><![CDATA[Sql Server 2005]]></category>

		<guid isPermaLink="false">http://cubicthoughts.com/?p=55</guid>
		<description><![CDATA[Today, I found this very very useful blog on how to convert ntext fields to nvarchar(max) in Sql 2005. Apparently when converting a field from ntext to nvarchar(max), SQL Server does not change the internal structure and this is bad as the performance slows down significantly. However the following blog has got a simple fix [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I found this very very useful blog on how to convert ntext fields to nvarchar(max) in Sql 2005. Apparently when converting a field from ntext to nvarchar(max), SQL Server does not change the internal structure and this is bad as the performance slows down significantly. However the following blog has got a simple fix to make SQL do the correct change.</p>
<p><a title="ntext vs nvarchar(max) in Sql Server 2005" href="http://geekswithblogs.net/johnsPerfBlog/archive/2008/04/16/ntext-vs-nvarcharmax-in-sql-2005.aspx" target="_blank">http://geekswithblogs.net/johnsPerfBlog/archive/2008/04/16/ntext-vs-nvarcharmax-in-sql-2005.aspx</a></p>
Written by Deepak Vasa - <a href="http://www.cubicthoughts.com">Visit Website</a>]]></content:encoded>
			<wfw:commentRss>http://cubicthoughts.com/2008/08/05/how-to-convert-ntext-to-nvarcharmax-in-sql-2005-the-right-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

