<?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/"
	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>Comments on: SQL SERVER &#8211; 2008 &#8211; Introduction to SPARSE Columns &#8211; Part 2</title>
	<atom:link href="http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Sun, 12 Feb 2012 09:22:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: mbourgon</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-237900</link>
		<dc:creator><![CDATA[mbourgon]]></dc:creator>
		<pubDate>Sun, 15 Jan 2012 07:13:54 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-237900</guid>
		<description><![CDATA[Ganesan, it&#039;s all about ratios and percentages.  Here&#039;s the formula I came up with, based on trial and error.  Yours isn&#039;t a good test, since you always have the same length, and the ratio is 50%.  Remember that the overhead is an extra 2 bytes for each field.  

Standard
=(Number_Of_Rows*(Average_Varchar_Length+2)
*((100-Percent_Null)/100))
+(Number_Of_Rows*(Percent_Null/100*2))

Sparse:
=(Number_Of_Rows*(Average_Varchar_Length+4))*((100-Percent_Null)/100)]]></description>
		<content:encoded><![CDATA[<p>Ganesan, it&#8217;s all about ratios and percentages.  Here&#8217;s the formula I came up with, based on trial and error.  Yours isn&#8217;t a good test, since you always have the same length, and the ratio is 50%.  Remember that the overhead is an extra 2 bytes for each field.  </p>
<p>Standard<br />
=(Number_Of_Rows*(Average_Varchar_Length+2)<br />
*((100-Percent_Null)/100))<br />
+(Number_Of_Rows*(Percent_Null/100*2))</p>
<p>Sparse:<br />
=(Number_Of_Rows*(Average_Varchar_Length+4))*((100-Percent_Null)/100)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ganesan Jeevanandam</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-234789</link>
		<dc:creator><![CDATA[Ganesan Jeevanandam]]></dc:creator>
		<pubDate>Tue, 10 Jan 2012 12:36:54 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-234789</guid>
		<description><![CDATA[Hi ,
 I tried with the below statement i.e Inserted not null and null values alternatively . The table with sparse columns takes more space than tables having unsparced columns.  Any idea on this behavior ?

CREATE TABLE UnSparsed(ID INT IDENTITY(1,1),
FirstCol INT,
SecondCol VARCHAR(100),
ThirdCol SmallDateTime)
GO
CREATE TABLE Sparsed(ID INT IDENTITY(1,1),
FirstCol INT SPARSE,
SecondCol VARCHAR(100) SPARSE,
ThirdCol SmallDateTime SPARSE)
GO
DECLARE @idx INT = 0

DECLARE @FirstCol INT,
@SecondCol VARCHAR(100),
@ThirdCol SmallDateTime

WHILE @idx &lt; 150000
BEGIN

Select @FirstCol = Case when @idx%2 = 0 Then 1000
Else Null End

Select @SecondCol = Case when @idx%2 = 0 Then &#039;Value&#039;
Else Null End

Select @ThirdCol = Case when @idx%2 = 0 Then GETDATE()
Else Null End

INSERT INTO UnSparsed VALUES (@FirstCol,@SecondCol, @ThirdCol)
INSERT INTO Sparsed VALUES (@FirstCol, @SecondCol, @ThirdCol)
SET @idx+=1
END
GO
sp_spaceused &#039;UnSparsed&#039;
GO
sp_spaceused &#039;Sparsed&#039;
GO
DROP TABLE UnSparsed
GO
DROP TABLE Sparsed
GO


Here are the results

name	rows	reserved	data	index_size	unused
UnSparsed	150000     	4040 KB	3976 KB	8 KB	56 KB

name	rows	reserved	data	index_size	unused
Sparsed	150000     	4616 KB	4584 KB	8 KB	24 KB]]></description>
		<content:encoded><![CDATA[<p>Hi ,<br />
 I tried with the below statement i.e Inserted not null and null values alternatively . The table with sparse columns takes more space than tables having unsparced columns.  Any idea on this behavior ?</p>
<p>CREATE TABLE UnSparsed(ID INT IDENTITY(1,1),<br />
FirstCol INT,<br />
SecondCol VARCHAR(100),<br />
ThirdCol SmallDateTime)<br />
GO<br />
CREATE TABLE Sparsed(ID INT IDENTITY(1,1),<br />
FirstCol INT SPARSE,<br />
SecondCol VARCHAR(100) SPARSE,<br />
ThirdCol SmallDateTime SPARSE)<br />
GO<br />
DECLARE @idx INT = 0</p>
<p>DECLARE @FirstCol INT,<br />
@SecondCol VARCHAR(100),<br />
@ThirdCol SmallDateTime</p>
<p>WHILE @idx &lt; 150000<br />
BEGIN</p>
<p>Select @FirstCol = Case when @idx%2 = 0 Then 1000<br />
Else Null End</p>
<p>Select @SecondCol = Case when @idx%2 = 0 Then &#039;Value&#039;<br />
Else Null End</p>
<p>Select @ThirdCol = Case when @idx%2 = 0 Then GETDATE()<br />
Else Null End</p>
<p>INSERT INTO UnSparsed VALUES (@FirstCol,@SecondCol, @ThirdCol)<br />
INSERT INTO Sparsed VALUES (@FirstCol, @SecondCol, @ThirdCol)<br />
SET @idx+=1<br />
END<br />
GO<br />
sp_spaceused &#039;UnSparsed&#039;<br />
GO<br />
sp_spaceused &#039;Sparsed&#039;<br />
GO<br />
DROP TABLE UnSparsed<br />
GO<br />
DROP TABLE Sparsed<br />
GO</p>
<p>Here are the results</p>
<p>name	rows	reserved	data	index_size	unused<br />
UnSparsed	150000     	4040 KB	3976 KB	8 KB	56 KB</p>
<p>name	rows	reserved	data	index_size	unused<br />
Sparsed	150000     	4616 KB	4584 KB	8 KB	24 KB</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Larry Leonard</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-201530</link>
		<dc:creator><![CDATA[Larry Leonard]]></dc:creator>
		<pubDate>Mon, 21 Nov 2011 18:29:55 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-201530</guid>
		<description><![CDATA[Maybe I&#039;m sleepy, but I don&#039;t understand this at all:

&quot;Clustered index or a unique primary key index can not be applied SPARSE column. SPARSE column can not be part of clustered index key.&quot;

What is a &quot;clustered index key&quot;?  Do you mean a clustered index that supports a key?  But the first sentence already says a SPARSE column cannot have a clustered index placed on it. Or do you mean that a column that is part of a key which is supported by a clustered index cannot be SPARSE?   BOL just says:

&quot;A sparse column cannot be part of a clustered index or a unique primary key index.&quot;

Is what you&#039;re saying the same thing?  Or something different?  Thanks.]]></description>
		<content:encoded><![CDATA[<p>Maybe I&#8217;m sleepy, but I don&#8217;t understand this at all:</p>
<p>&#8220;Clustered index or a unique primary key index can not be applied SPARSE column. SPARSE column can not be part of clustered index key.&#8221;</p>
<p>What is a &#8220;clustered index key&#8221;?  Do you mean a clustered index that supports a key?  But the first sentence already says a SPARSE column cannot have a clustered index placed on it. Or do you mean that a column that is part of a key which is supported by a clustered index cannot be SPARSE?   BOL just says:</p>
<p>&#8220;A sparse column cannot be part of a clustered index or a unique primary key index.&#8221;</p>
<p>Is what you&#8217;re saying the same thing?  Or something different?  Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mbourgon</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-193204</link>
		<dc:creator><![CDATA[Mbourgon]]></dc:creator>
		<pubDate>Fri, 11 Nov 2011 14:30:49 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-193204</guid>
		<description><![CDATA[Ytalo, that&#039;s a bug. Open a case with MS. Can you elaborate on what happened?]]></description>
		<content:encoded><![CDATA[<p>Ytalo, that&#8217;s a bug. Open a case with MS. Can you elaborate on what happened?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ytalo</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-192628</link>
		<dc:creator><![CDATA[Ytalo]]></dc:creator>
		<pubDate>Thu, 10 Nov 2011 20:34:08 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-192628</guid>
		<description><![CDATA[Sparse columns brokes cursor statements. Until you restart your database server !.
Someone should write this issue in &quot;Restrictions for Using Sparse Columns&quot; section on MSDN library.]]></description>
		<content:encoded><![CDATA[<p>Sparse columns brokes cursor statements. Until you restart your database server !.<br />
Someone should write this issue in &#8220;Restrictions for Using Sparse Columns&#8221; section on MSDN library.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dev One</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-189924</link>
		<dc:creator><![CDATA[Dev One]]></dc:creator>
		<pubDate>Mon, 07 Nov 2011 07:16:25 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-189924</guid>
		<description><![CDATA[Sparse columns are incompatible with data compression. Therefore sparse columns cannot be added to compressed tables, nor can any tables containing sparse columns be compressed.
@Reference MSDN : &quot;http://msdn.microsoft.com/en-us/library/cc280604.aspx&quot;]]></description>
		<content:encoded><![CDATA[<p>Sparse columns are incompatible with data compression. Therefore sparse columns cannot be added to compressed tables, nor can any tables containing sparse columns be compressed.<br />
@Reference MSDN : &#8220;http://msdn.microsoft.com/en-us/library/cc280604.aspx&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mbourgon</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-66342</link>
		<dc:creator><![CDATA[Mbourgon]]></dc:creator>
		<pubDate>Thu, 22 Apr 2010 23:08:15 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-66342</guid>
		<description><![CDATA[@mike, Honestly, I think it&#039;s going to depend on a whole lot of things.  Average size of the XML column that houses them all, but most importantly whether it&#039;s part of any of the search arguments.  If it&#039;s just in the returned set I think you&#039;re fine, but I wouldn&#039;t use it if it&#039;s in the WHERE clause.]]></description>
		<content:encoded><![CDATA[<p>@mike, Honestly, I think it&#8217;s going to depend on a whole lot of things.  Average size of the XML column that houses them all, but most importantly whether it&#8217;s part of any of the search arguments.  If it&#8217;s just in the returned set I think you&#8217;re fine, but I wouldn&#8217;t use it if it&#8217;s in the WHERE clause.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-66027</link>
		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Wed, 21 Apr 2010 21:02:38 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-66027</guid>
		<description><![CDATA[Can you be more specific when you say that rows containing sparse columns take a performance hit?   Any metrics?]]></description>
		<content:encoded><![CDATA[<p>Can you be more specific when you say that rows containing sparse columns take a performance hit?   Any metrics?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mbourgon</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-64619</link>
		<dc:creator><![CDATA[Mbourgon]]></dc:creator>
		<pubDate>Tue, 06 Apr 2010 23:44:48 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-64619</guid>
		<description><![CDATA[Gan - it has to scan/parse the SPARSE column&#039;s XML to find the field and extract it.]]></description>
		<content:encoded><![CDATA[<p>Gan &#8211; it has to scan/parse the SPARSE column&#8217;s XML to find the field and extract it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: R5D4</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-56568</link>
		<dc:creator><![CDATA[R5D4]]></dc:creator>
		<pubDate>Fri, 09 Oct 2009 19:56:50 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-56568</guid>
		<description><![CDATA[Great explanation as ever Pinal, have linked you from my blog.

r]]></description>
		<content:encoded><![CDATA[<p>Great explanation as ever Pinal, have linked you from my blog.</p>
<p>r</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gan</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-48948</link>
		<dc:creator><![CDATA[Gan]]></dc:creator>
		<pubDate>Fri, 13 Mar 2009 23:56:04 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-48948</guid>
		<description><![CDATA[&quot;A table operation which involves SPARSE column takes performance hit over regular column&quot;

Can you elaborate on what you mean by above?  How severe is the performance impact?]]></description>
		<content:encoded><![CDATA[<p>&#8220;A table operation which involves SPARSE column takes performance hit over regular column&#8221;</p>
<p>Can you elaborate on what you mean by above?  How severe is the performance impact?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sreekar M</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-45453</link>
		<dc:creator><![CDATA[Sreekar M]]></dc:creator>
		<pubDate>Thu, 08 Jan 2009 06:15:18 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-45453</guid>
		<description><![CDATA[The maximum number of supported sparse columns in a table is 30000 only but not 100000 in SQL Server 2008]]></description>
		<content:encoded><![CDATA[<p>The maximum number of supported sparse columns in a table is 30000 only but not 100000 in SQL Server 2008</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Qingsong Yao</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-43539</link>
		<dc:creator><![CDATA[Qingsong Yao]]></dc:creator>
		<pubDate>Mon, 06 Oct 2008 18:37:08 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-43539</guid>
		<description><![CDATA[if you create a wide table (i.e., a table with column set).  The default in/out method will only show the column set and hidden all sparse columns.  If you want to import using the sparse columns,  you may need to create a customized format file.  Please refer the bcp format file for details.]]></description>
		<content:encoded><![CDATA[<p>if you create a wide table (i.e., a table with column set).  The default in/out method will only show the column set and hidden all sparse columns.  If you want to import using the sparse columns,  you may need to create a customized format file.  Please refer the bcp format file for details.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mo Tamman</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-42940</link>
		<dc:creator><![CDATA[Mo Tamman]]></dc:creator>
		<pubDate>Thu, 18 Sep 2008 13:33:31 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-42940</guid>
		<description><![CDATA[So I&#039;ve created my wide table and I need to import a comma delimited file...and for the life of me, I cannot get it to import.

I&#039;ve used the import wizard (didn&#039;t expect that to work) and bulk insert, all to no avail.

Is there a trick to this?]]></description>
		<content:encoded><![CDATA[<p>So I&#8217;ve created my wide table and I need to import a comma delimited file&#8230;and for the life of me, I cannot get it to import.</p>
<p>I&#8217;ve used the import wizard (didn&#8217;t expect that to work) and bulk insert, all to no avail.</p>
<p>Is there a trick to this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Qingsong Yao</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-41688</link>
		<dc:creator><![CDATA[Qingsong Yao]]></dc:creator>
		<pubDate>Thu, 14 Aug 2008 19:19:06 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-41688</guid>
		<description><![CDATA[Hello, Richard
  In order to create more than 1024 columns,  you have to have a columnset column defined in the table.  We explict request this because the client can not retrieve more than 1024 columns, and  we do not want people facing the issue of not being to retrieving data.  Once the table has columnset defined, the select * will hide all sparse columns, and only see the column set.  Neanwhile, people can still select individual sparse columns in their query.   The default value of sparse column is NUll, that is the reason why we can not have default or rule on the column]]></description>
		<content:encoded><![CDATA[<p>Hello, Richard<br />
  In order to create more than 1024 columns,  you have to have a columnset column defined in the table.  We explict request this because the client can not retrieve more than 1024 columns, and  we do not want people facing the issue of not being to retrieving data.  Once the table has columnset defined, the select * will hide all sparse columns, and only see the column set.  Neanwhile, people can still select individual sparse columns in their query.   The default value of sparse column is NUll, that is the reason why we can not have default or rule on the column</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Topf</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-41526</link>
		<dc:creator><![CDATA[Richard Topf]]></dc:creator>
		<pubDate>Sat, 09 Aug 2008 13:57:58 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-41526</guid>
		<description><![CDATA[Sorry if this is a naive point!

Now we have the final release of SQl 2008, I have been trying to create a table with more that 1024 columns. I cannot. Even if all columns are defined as &#039;int sparse&#039; I still get a max 1024 col error message.

Any advice would be very welcome.]]></description>
		<content:encoded><![CDATA[<p>Sorry if this is a naive point!</p>
<p>Now we have the final release of SQl 2008, I have been trying to create a table with more that 1024 columns. I cannot. Even if all columns are defined as &#8216;int sparse&#8217; I still get a max 1024 col error message.</p>
<p>Any advice would be very welcome.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kamran Shahid</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-40889</link>
		<dc:creator><![CDATA[Kamran Shahid]]></dc:creator>
		<pubDate>Mon, 28 Jul 2008 07:36:14 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-40889</guid>
		<description><![CDATA[SPARSE column can not have default value or rule or computed column.

Only this thing looks odd.Other things are not that much problem]]></description>
		<content:encoded><![CDATA[<p>SPARSE column can not have default value or rule or computed column.</p>
<p>Only this thing looks odd.Other things are not that much problem</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - 2008 - Introduction to SPARSE Columns Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/#comment-40200</link>
		<dc:creator><![CDATA[SQL SERVER - 2008 - Introduction to SPARSE Columns Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Mon, 14 Jul 2008 09:52:23 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=683#comment-40200</guid>
		<description><![CDATA[[...] UPDATE : Read Advantages and Disadvantages of SPARSE Column SQL SERVER - 2008 - Introduction to SPARSE Columns - Part 2 [...]]]></description>
		<content:encoded><![CDATA[<p>[...] UPDATE : Read Advantages and Disadvantages of SPARSE Column SQL SERVER &#8211; 2008 &#8211; Introduction to SPARSE Columns &#8211; Part 2 [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

