<?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>A Developer&#039;s Blog &#187; SQL Server</title>
	<atom:link href="http://blog.hoegaerden.be/tag/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hoegaerden.be</link>
	<description>SQL Server, BI, .NET, IT and anything else I have been playing with.</description>
	<lastBuildDate>Wed, 01 Feb 2012 16:15:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Posting An Issue To Microsoft Connect</title>
		<link>http://blog.hoegaerden.be/2012/01/04/posting-an-issue-to-microsoft-connect/</link>
		<comments>http://blog.hoegaerden.be/2012/01/04/posting-an-issue-to-microsoft-connect/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 11:21:05 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[Microsoft Connect]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2012/01/04/posting-an-issue-to-microsoft-connect/</guid>
		<description><![CDATA[I’ve been a user of the Microsoft Connect site for several years now.  A regular user who now and then casts an Up vote or clicks the “I can reproduce it!” link.  Not as a content poster.  Well, I did post some comments in the past, but I never filed an issue or suggestion. So, [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been a user of the <a title="Microsoft Connect" href="https://connect.microsoft.com/" target="_blank">Microsoft Connect</a> site for several years now.  A regular user who now and then casts an Up vote or clicks the “I can reproduce it!” link.  Not as a content poster.  Well, I did post some comments in the past, but I never filed an issue or suggestion.</p>
<p>So, a couple of weeks ago I decided to post my first bug to Microsoft Connect, an issue which I had discovered in SQL Server 2012 RC0.  Because this process took me more time than I’d expected, I‘m now blogging about my experience.</p>
<p>The hardest part about the whole experience was finding the actual page that needs to be used to enter and submit the content.</p>
<h2>Submitting Content To Microsoft Connect</h2>
<p>Are you in for a ride on the Connect site?  Here we go!</p>
<h3>Step 1: Search For Your Product on The Connect Home Page</h3>
<h3><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Enter a search term on Microsoft Connect to locate your favorite product" src="http://blog.hoegaerden.be/wp-content/uploads/image439.png" border="0" alt="Enter a search term on Microsoft Connect to locate your favorite product" width="700" height="430" /></h3>
<p>On the Home page, enter a search term with which you can locate your favorite product.  If you’re not signed in yet, do that first.</p>
<h3>Step 2: Click To Participate</h3>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image440.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="On the search results, click the Participate link next to your favorite product." src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb104.png" border="0" alt="On the search results, click the Participate link next to your favorite product." width="700" height="261" /></a></p>
<p>Once the search engine has produced the output, locate your favorite product and click the <strong>Participate</strong> action next to it.</p>
<h3>Step 3: Submit Product Feedback</h3>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Click Submit Product Feedback to submit product feedback." src="http://blog.hoegaerden.be/wp-content/uploads/image441.png" border="0" alt="Click Submit Product Feedback to submit product feedback." width="700" height="692" /></p>
<p>After clicking Participate, the following overwhelming screen appears.  The link that you’re looking for is called <strong>Submit Product Feedback</strong>.</p>
<h3>Step 4: The Feedback Center</h3>
<p>After clicking Submit Product Feedback, you end up at the <a title="Feedback Center" href="https://connect.microsoft.com/SQLServer/Feedback" target="_blank">Feedback Center</a>.</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="Do not use the Submit link, use Search first to check if your issue already exists." src="http://blog.hoegaerden.be/wp-content/uploads/image442.png" border="0" alt="Do not use the Submit link, use Search first to check if your issue already exists." width="700" height="557" /></p>
<p>Looking at the screen above, you’d think that the yellow Submit Feedback button can be used to open the page where you’d need to enter the bug details.  Well, it doesn’t…</p>
<p>You need to search for your issue first, to ensure it doesn’t exist already.</p>
<h3>Step 5: The Submit Feedback Button Has Been Found, Eureka!</h3>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="The Submit Feedback button on the Product Search Results screen." src="http://blog.hoegaerden.be/wp-content/uploads/image443.png" border="0" alt="The Submit Feedback button on the Product Search Results screen." width="700" height="259" /></p>
<p>After you’ve performed the search for your issue, you get to the following page above.  Finally, on that page you can click a real <strong>Submit Feedback</strong> button that will bring you to the Select Feedback Form page.</p>
<h3>Step 6: Select Your Feedback Form Of Choice</h3>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="Select SQL Server Bug Form to file a SQL Server issue, or SQL Server Suggestion Form for a suggestion." src="http://blog.hoegaerden.be/wp-content/uploads/image444.png" border="0" alt="Select SQL Server Bug Form to file a SQL Server issue, or SQL Server Suggestion Form for a suggestion." width="550" height="198" /></p>
<p>On the <a title="Select Feedback Form" href="https://connect.microsoft.com/SQLServer/feedback/CreateFeedback.aspx" target="_blank">Select Feedback Form</a> page, select <strong>SQL Server Bug Form</strong> to file a SQL Server issue, or select<strong> SQL Server Suggestion Form</strong> to enter a suggestion.</p>
<h3>Step 7: Fill Out The Textboxes</h3>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="The &quot;Submit A Bug&quot; Form for SQL Server." src="http://blog.hoegaerden.be/wp-content/uploads/image445.png" border="0" alt="The &quot;Submit A Bug&quot; Form for SQL Server." width="700" height="529" /></p>
<p>Finally, the page we’ve been trying to locate when we started the adventure, quest accomplished!  With this new knowledge, we can now skip directly to step 6 through the following link: <a title="Select Feedback Form" href="https://connect.microsoft.com/SQLServer/feedback/CreateFeedback.aspx" target="_blank">Select Feedback Form</a></p>
<p><em>Disclaimer: please ensure that you’re not creating duplicate bugs or suggestions, but use whatever search engine your prefer to achieve that goal!</em></p>
<p>So, here’s my New Year’s present to all of you!  And remember: have fun!</p>
<p>Valentino.</p>
<p><strong>References</strong></p>
<p><a title="Microsoft Connect" href="https://connect.microsoft.com/" target="_blank">Microsoft Connect</a></p>
<p><a title="Feedback Center" href="https://connect.microsoft.com/SQLServer/Feedback" target="_blank">Feedback Center</a></p>
<p><a title="Select Feedback Form" href="https://connect.microsoft.com/SQLServer/feedback/CreateFeedback.aspx" target="_blank">Select Feedback Form</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2012%2F01%2F04%2Fposting-an-issue-to-microsoft-connect%2F&amp;title=Posting%20An%20Issue%20To%20Microsoft%20Connect" id="wpa2a_2"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2012/01/04/posting-an-issue-to-microsoft-connect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Record Count For All Tables In Database</title>
		<link>http://blog.hoegaerden.be/2011/05/21/record-count-for-all-tables-in-database/</link>
		<comments>http://blog.hoegaerden.be/2011/05/21/record-count-for-all-tables-in-database/#comments</comments>
		<pubDate>Sat, 21 May 2011 08:46:33 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2011/05/21/record-count-for-all-tables-in-database/</guid>
		<description><![CDATA[In this post I’m actually just going to repeat what I answered to a question on Experts Exchange. The OP was having an issue getting a record count of all tables in his database.  It was working through the Management Studio, using the undocumented but well-known sp_MSforeachtable stored procedure. exec sp_MSforeachtable 'select ''?'' TableName, count(*) [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I’m actually just going to repeat what I answered to <a title="EE Q about getting a row count of each table in database" href="http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL_Server_2008/Q_27038565.html" target="_blank">a question on Experts Exchange</a>.</p>
<p>The OP was having an issue getting a record count of all tables in his database.  It was working through the Management Studio, using the undocumented but well-known sp_MSforeachtable stored procedure.</p>
<pre class="code"><span style="color: blue;">exec </span><span style="color: maroon;">sp_MSforeachtable </span><span style="color: red;">'select ''?'' TableName, count(*) Cnt from ?'</span><span style="color: gray;">;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>However, the OP needed the list of record counts inside an Integration Services package.  And this didn’t work out as expected, because sp_MSforeachtable uses a temporary table, something that SSIS does not like.</p>
<p>So I proposed to use a script similar to the following, possibly in a stored procedure.</p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<pre class="code"><span style="color: green;">/*
DESCRIPTION: Returns a list of record counts for each table in the database
AUTHOR:         Valentino Vranken
CREATED:     2011/05/21
VERSION:     1.0
COPIED FROM: http://blog.hoegaerden.be
*/
</span><span style="color: blue;">declare </span>@tempTable <span style="color: blue;">table
</span><span style="color: gray;">(
    </span>TableSchema <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>256<span style="color: gray;">),
    </span>TableName <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>256<span style="color: gray;">),
    </span>Cnt <span style="color: blue;">bigint
</span><span style="color: gray;">);

</span><span style="color: blue;">declare </span>@sql <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>4000<span style="color: gray;">);
</span><span style="color: blue;">declare </span>@tableSchema <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>256<span style="color: gray;">);
</span><span style="color: blue;">declare </span>@tableName <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>256<span style="color: gray;">);
</span><span style="color: blue;">declare </span>@columnName <span style="color: blue;">sysname</span><span style="color: gray;">;
</span><span style="color: blue;">declare </span>@cnt <span style="color: blue;">bigint</span><span style="color: gray;">;

</span><span style="color: blue;">declare </span>tableCursor <span style="color: blue;">cursor for
    select </span>TABLE_SCHEMA<span style="color: gray;">, </span>TABLE_NAME <span style="color: blue;">from </span><span style="color: green;">INFORMATION_SCHEMA</span><span style="color: gray;">.</span><span style="color: green;">TABLES
    </span><span style="color: blue;">where </span>TABLE_TYPE <span style="color: gray;">= </span><span style="color: red;">'BASE TABLE'</span><span style="color: gray;">;

</span><span style="color: blue;">open </span>tableCursor<span style="color: gray;">;

</span><span style="color: blue;">fetch next from </span>tableCursor <span style="color: blue;">into </span>@tableSchema<span style="color: gray;">, </span>@tableName<span style="color: gray;">;

</span><span style="color: blue;">while </span><span style="color: magenta;">@@FETCH_STATUS </span><span style="color: gray;">= </span>0
<span style="color: blue;">begin
    set </span>@sql <span style="color: gray;">= </span><span style="color: red;">'select @cnt = COUNT(*) from [' </span><span style="color: gray;">+ </span>@tableSchema <span style="color: gray;">+ </span><span style="color: red;">'].[' </span><span style="color: gray;">+ </span>@tableName <span style="color: gray;">+ </span><span style="color: red;">']'</span><span style="color: gray;">;

    </span><span style="color: blue;">exec </span><span style="color: maroon;">sp_executesql </span>@sql<span style="color: gray;">, </span><span style="color: red;">N'@cnt bigint output'</span><span style="color: gray;">, </span>@cnt <span style="color: gray;">= </span>@cnt <span style="color: blue;">output</span><span style="color: gray;">;

    </span><span style="color: blue;">insert into </span>@tempTable <span style="color: blue;">select </span>@tableSchema<span style="color: gray;">, </span>@tableName<span style="color: gray;">, </span>@cnt<span style="color: gray;">;

    </span><span style="color: blue;">fetch next from </span>tableCursor <span style="color: blue;">into </span>@tableSchema<span style="color: gray;">, </span>@tableName<span style="color: gray;">;
</span><span style="color: blue;">end</span><span style="color: gray;">;

</span><span style="color: blue;">close </span>tableCursor<span style="color: gray;">;
</span><span style="color: blue;">deallocate </span>tableCursor<span style="color: gray;">;

</span><span style="color: blue;">select </span><span style="color: gray;">* </span><span style="color: blue;">from </span>@tempTable<span style="color: gray;">;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Yeah, I know, cursors are bad… But hey, at least it works!  Just don’t schedule it for execution every five seconds.</p>
<p><em>I seem to be repeating myself.  I wrote something similar when I posted <a title="Script: Find All Empty Columns In Database" href="http://blog.hoegaerden.be/2009/02/15/script-find-all-empty-columns-in-database/" target="_blank">the script about finding empty columns</a> many months ago.</em></p>
<p>The most important part of the script is the following:</p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<pre class="code"><span style="color: blue;">select </span>TABLE_SCHEMA<span style="color: gray;">, </span>TABLE_NAME <span style="color: blue;">from </span><span style="color: green;">INFORMATION_SCHEMA</span><span style="color: gray;">.</span><span style="color: green;">TABLES
</span><span style="color: blue;">where </span>TABLE_TYPE <span style="color: gray;">= </span><span style="color: red;">'BASE TABLE'</span><span style="color: gray;">;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>This is using one of the information schema views to retrieve a list of tables in the database.  The INFORMATION_SCHEMA.TABLES view contains a list of tables and views, so the where clause is needed to filter out the views.  INFORMATION_SCHEMA.TABLES is just one of <a title="Information Schema Views (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms186778.aspx" target="_blank">many interesting views available in SQL Server</a>, and should always be used in favor of the sys tables.</p>
<p>What does the output look like?  Here’s part of the output when executed on the AdventureWorks2008R2 database:</p>
<p><img style="display: inline; border: 0px;" title="Record count of all tables in the AdventureWorks2008R2 database (although not all are shown, you get the idea)" src="http://blog.hoegaerden.be/wp-content/uploads/image415.png" border="0" alt="Record count of all tables in the AdventureWorks2008R2 database (although not all are shown, you get the idea)" width="376" height="183" /></p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2011%2F05%2F21%2Frecord-count-for-all-tables-in-database%2F&amp;title=Record%20Count%20For%20All%20Tables%20In%20Database" id="wpa2a_4"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2011/05/21/record-count-for-all-tables-in-database/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SQL Server Day 2010: The Videos</title>
		<link>http://blog.hoegaerden.be/2011/01/15/sql-server-day-2010-the-videos/</link>
		<comments>http://blog.hoegaerden.be/2011/01/15/sql-server-day-2010-the-videos/#comments</comments>
		<pubDate>Sat, 15 Jan 2011 14:27:04 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Community Event]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[SQLUG]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2011/01/15/sql-server-day-2010-the-videos/</guid>
		<description><![CDATA[Last month we had the pleasure of enjoying the third edition of our Belgian SQL Server Day.  If you were there and you were unable to attend a particular session, even though you were interested in it, here’s your answer.  The sessions have been recorded, and the videos are now available online!  How’s that for [...]]]></description>
			<content:encoded><![CDATA[<p>Last month we had the pleasure of enjoying the third edition of our Belgian SQL Server Day.  If you were there and you were unable to attend a particular session, even though you were interested in it, here’s your answer.  The sessions have been recorded, and the videos are now available online!  How’s that for a New Year’s present?</p>
<p><a title="SQL Server Day 2010: The Videos" href="http://www.sqlserverday.be/video/" target="_blank"><img style="display: inline; border: 0px;" title="SQL Server Day 2010: The Videos" src="http://blog.hoegaerden.be/wp-content/uploads/image365.png" border="0" alt="SQL Server Day 2010: The Videos" width="672" height="127" /></a></p>
<p>And if those videos didn’t still your hunger, or you just have plenty of time to kill, <a title="Chris Webb's BI Blog: Videos!" href="http://cwebbbi.wordpress.com/2011/01/12/powerpivot-videos-from-sql-server-day-2010/" target="_blank">check out this blog post on Chris Webb’s BI blog</a>.  He has posted a link to the 152 videos of SQL Bits, a three-day SQL Server event in the UK.</p>
<p>Still not satisfied?  Maybe these <a title="SQL Server 2008 Microsoft Certified Master (MCM) Readiness Videos" href="http://technet.microsoft.com/en-us/sqlserver/ff977043.aspx" target="_blank">SQL Server 2008 Microsoft Certified Master (MCM) Readiness Videos</a> can keep you busy for a little while then. <img src='http://blog.hoegaerden.be/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2011%2F01%2F15%2Fsql-server-day-2010-the-videos%2F&amp;title=SQL%20Server%20Day%202010%3A%20The%20Videos" id="wpa2a_6"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2011/01/15/sql-server-day-2010-the-videos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where&#8217;s The (Windows) User?</title>
		<link>http://blog.hoegaerden.be/2011/01/14/wheres-the-windows-user/</link>
		<comments>http://blog.hoegaerden.be/2011/01/14/wheres-the-windows-user/#comments</comments>
		<pubDate>Fri, 14 Jan 2011 17:48:46 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[T-SQL]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2011/01/14/wheres-the-windows-user/</guid>
		<description><![CDATA[Have you ever needed to write a script that would store the Windows login of the user that executes the script in a table, without hard-coding it?  And you couldn’t find your way through the user jungle of T-SQL?  Then read on! A normal approach would be to rely on the IntelliSense feature of SSMS [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever needed to write a script that would store the Windows login of the user that executes the script in a table, without hard-coding it?  And you couldn’t find your way through the user jungle of T-SQL?  Then read on!</p>
<p>A normal approach would be to rely on the IntelliSense feature of SSMS and start typing something like:</p>
<pre class="code"><span style="color: blue;">select use</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Which gives you a dropdown like:</p>
<p><img style="display: inline; border-width: 0px;" title="image" src="http://blog.hoegaerden.be/wp-content/uploads/image363.png" border="0" alt="image" width="540" height="209" /></p>
<p>Cool you think, there are four system functions to return something user-related, one of them would be the Windows user, right?  Well, wrong.</p>
<p>Let’s find out what these functions actually return, and locate a method that does return what we require.</p>
<h2>The Different User-Related System Functions</h2>
<h3>USER</h3>
<p>According to the BOL:</p>
<blockquote><p>Allows a system-supplied value for the database user name of the current user to be inserted into a table when no default value is specified.</p></blockquote>
<p>So, how many times did you read that?  And do you now know what you’ll get?  Me neither.  As far as I understand it, you’ll get the database user name of the connection context.  Not what we need.</p>
<h3>USER_ID</h3>
<p>According to BOL:</p>
<blockquote><p>Returns the identification number for a database user.</p></blockquote>
<p>The function accepts one argument that accepts a string representing a username.  When no argument is provided, it will return the user ID of the execution context.</p>
<p>But that’s not important because the BOL also mentions that it will be removed in a future version and that you thus shouldn’t use it anymore.  No problem if you need it though, its replacement is called DATABASE_PRINCIPAL_ID.</p>
<h3>USER_NAME</h3>
<p>According to BOL:</p>
<blockquote><p>Returns a database user name from a specified identification number.</p></blockquote>
<p>This is the inverse of USER_ID.  It accepts one argument representing the user ID.  When omitted, the user of the current execution context will be returned.  Which is actually the equivalent of the USER function.</p>
<p>Still no Windows user though, so let’s move on to the next one.</p>
<h3>USER_SID</h3>
<p>Not documented in the BOL.</p>
<p>It seems to represent the <strong>sid </strong>column found through following query:</p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<pre class="code"><span style="color: blue;">select </span><span style="color: gray;">* </span><span style="color: blue;">from </span><span style="color: green;">sys</span><span style="color: gray;">.</span><span style="color: green;">sysusers</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>And the sys.sysusers view is documented.  Apparently “sid” stands for “security identifier” and it’s a varbinary.  But not only is the view documented, it is also deprecated.  You should use the following view instead:</p>
<pre class="code"><span style="color: blue;">select </span><span style="color: gray;">* </span><span style="color: blue;">from </span><span style="color: green;">sys</span><span style="color: gray;">.</span><span style="color: green;">database_principals</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>That query returns a list of principals in the current database, and one of the fields is indeed our dear sid.  However, we can now conclude that sid is definitely not what we’re looking for in this little quest, it doesn’t even closely resemble a Windows user name.  So let’s move on again!</p>
<h3>CURRENT_USER</h3>
<p>Hmm, “current user”, will this finally be the Windows user with which I’m running my queries?</p>
<p>According to BOL:</p>
<blockquote><p>Returns the name of the current user. This function is equivalent to USER_NAME().</p></blockquote>
<p>Equivalent to USER_NAME, so still not what we’re looking for.</p>
<h3>SESSION_USER</h3>
<p>According to BOL:</p>
<blockquote><p>SESSION_USER returns the user name of the current context in the current database.</p></blockquote>
<p>You can probably guess by now that again this is not what we’re searching for.  Next.</p>
<h3>SYSTEM_USER</h3>
<p>According to BOL:</p>
<blockquote><p>Allows a system-supplied value for the current login to be inserted into a table when no default value is specified.</p></blockquote>
<p>Ah, finally a description that contains the word “login”!  And indeed, here’s what it returns:</p>
<blockquote><p>ORDINA\VaVr</p></blockquote>
<p>That is indeed my Windows user.  Mission accomplished!</p>
<p><strong><span style="text-decoration: underline;">Please note:</span></strong> if you’re running this through a window connected via a SQL Server login, you will get that login as opposed to your Windows login.  And if you get ‘sa’ while you’re connected to a production server you should look into making some security changes. <img src='http://blog.hoegaerden.be/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h3>SUSER_NAME and SUSER_SNAME</h3>
<p>Two more similar functions exist: SUSER_NAME and SUSER_SNAME.</p>
<p>Both return a login name as well, and both accept a parameter.  When executed without parameter, they return the login name of the current user.  Their only difference is the parameter that they accept.  SUSER_NAME accepts the “login identification number of the user”, which is an <strong>int</strong>, and SUSER_SNAME accepts the “login security identification number”, a <strong>varbinary(85)</strong> (remember sid from above?).</p>
<h3>Quick Query</h3>
<p>The following query shows how to use all the functions, with the default values for any parameters.</p>
<pre class="code"><span style="color: blue;">select </span><span style="color: magenta;">USER </span><span style="color: blue;">as </span>cUSER<span style="color: gray;">, </span><span style="color: magenta;">USER_ID</span><span style="color: gray;">() </span><span style="color: blue;">as </span>cUSER_ID<span style="color: gray;">, </span><span style="color: magenta;">USER_NAME</span><span style="color: gray;">() </span><span style="color: blue;">as </span><span style="color: magenta;">USER_NAME</span><span style="color: gray;">,
    </span><span style="color: magenta;">USER_SID</span><span style="color: gray;">() </span><span style="color: blue;">as </span>cUSER_SID<span style="color: gray;">, </span><span style="color: magenta;">CURRENT_USER </span><span style="color: blue;">as </span>cCURRENT_USER<span style="color: gray;">,
    </span><span style="color: magenta;">SESSION_USER </span><span style="color: blue;">as </span>cSESSION_USER<span style="color: gray;">, </span><span style="color: magenta;">SYSTEM_USER </span><span style="color: blue;">as </span>cSYSTEM_USER<span style="color: gray;">,
    </span><span style="color: magenta;">SUSER_NAME</span><span style="color: gray;">() </span><span style="color: blue;">as </span>cSUSER_NAME<span style="color: gray;">, </span><span style="color: magenta;">SUSER_SNAME</span><span style="color: gray;">() </span><span style="color: blue;">as </span>cSUSER_SNAME</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Have fun!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2011%2F01%2F14%2Fwheres-the-windows-user%2F&amp;title=Where%26rsquo%3Bs%20The%20%28Windows%29%20User%3F" id="wpa2a_8"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2011/01/14/wheres-the-windows-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server, What&#8217;s Your Version Number?</title>
		<link>http://blog.hoegaerden.be/2010/11/20/server-whats-your-version-number/</link>
		<comments>http://blog.hoegaerden.be/2010/11/20/server-whats-your-version-number/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 19:32:27 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[data]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/11/20/server-whats-your-version-number/</guid>
		<description><![CDATA[Here’s a quick post about one of my favorite pages on the Microsoft Support site.&#160; The page explains how to retrieve your SQL Server version, and also mentions the different version numbers of all major releases and service packs. One of my favorite statements since many years is the following: select @@version; Here’s the output [...]]]></description>
			<content:encoded><![CDATA[<p>Here’s a quick post about one of my favorite pages on the <a title="Microsoft Support" href="http://support.microsoft.com/" target="_blank">Microsoft Support</a> site.&#160; The page explains how to retrieve your SQL Server version, and also mentions the different version numbers of all major releases and service packs.</p>
<p>One of my favorite statements since many years is the following:</p>
<pre class="code"><span style="color: blue">select </span><span style="color: magenta">@@version</span><span style="color: gray">;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Here’s the output that it produces on my laptop running Windows 7, while connected to my R2 server:</p>
<blockquote>
<p>Microsoft SQL Server 2008 R2 (RTM) &#8211; 10.50.1600.1 (X64)&#160;&#160; Apr&#160; 2 2010 15:48:46&#160;&#160; Copyright (c) Microsoft Corporation&#160; Enterprise Edition (64-bit) on Windows NT 6.1 &lt;X64&gt; (Build 7600: )</p>
</blockquote>
<p>It not only retrieves the version, edition and CPU architecture of SQL Server, on top of that it also shows you the operating system version on which it is running!</p>
<p>The statement is easy to remember and gives you all the details that you need.&#160; Well, that depends on the situation of course.&#160; In one of my previous jobs I was, as developer, last-line support for an application that was used worldwide.&#160; Which means that now and then I had people on the phone that had “some vague issue” with our application.&#160; And even though I speak four languages (more or less), I can assure you that getting details through a phone line can be a tough job.&#160; I remember one case where I had to spend half an hour to get the person on the other side find the Start button.&#160; Yes, that stupid thing on the bottom left, the thing that you need all the time as a regular Windows user.&#160; And no, they we’re not on Windows 3.x anymore!&#160; In those times, it even had the letters S T A R and T all over it!&#160; But alas, it remained impossible to find.&#160; Then I switched to finding the clock.&#160; Guess what: wasn’t in the right bottom corner either!&#160; Further during the conversation I tried all other corners, also tried to explain that the status bar may have been set to automatically hide.&#160; Oh well, at a certain point they’d suddenly found it!&#160; I don’t know where, maybe on another PC, at that point I didn’t care anymore, I just wanted them to open up the Management Studio, er, Query Analyzer more likely.</p>
<p>Anyway, at times like that, you’re glad that easy SQL commands still exist.</p>
<p>The statement above is not the only possibility to get details about the SQL Server version.&#160; Another method is through the SERVERPROPERTY function.&#160; Here’s a sample statement (from the Books Online) to retrieve version information:</p>
<pre class="code"><span style="color: blue">SELECT </span><span style="color: magenta">SERVERPROPERTY</span><span style="color: gray">(</span><span style="color: red">'ProductVersion'</span><span style="color: gray">) </span><span style="color: blue">AS </span>ProductVersion<span style="color: gray">,
    </span><span style="color: magenta">SERVERPROPERTY</span><span style="color: gray">(</span><span style="color: red">'ProductLevel'</span><span style="color: gray">) </span><span style="color: blue">AS </span>ProductLevel<span style="color: gray">,
    </span><span style="color: magenta">SERVERPROPERTY</span><span style="color: gray">(</span><span style="color: red">'Edition'</span><span style="color: gray">) </span><span style="color: blue">AS </span>Edition<span style="color: gray">,
    </span><span style="color: magenta">SERVERPROPERTY</span><span style="color: gray">(</span><span style="color: red">'EngineEdition'</span><span style="color: gray">) </span><span style="color: blue">AS </span>EngineEdition<span style="color: gray">;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Try getting that to the other side of the phone line!&#160; And no, email was not an option either…</p>
<p>Here’s the statement’s output:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Output of SERVERPROPERTY sample statement" border="0" alt="Output of SERVERPROPERTY sample statement" src="http://blog.hoegaerden.be/wp-content/uploads/image357.png" width="422" height="67" /></p>
<p>Not only is the statement more difficult to remember, the output is less readable too.&#160; For instance you need to know that EngineEdition 3 means Enterprise Edition.</p>
<p>Nevertheless, it is a useful function with more possibilities than @@version.&#160; <a title="SERVERPROPERTY (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms174396.aspx" target="_blank">Check out the BOL</a> for all the details and available properties.</p>
<p>Let’s get back on topic now.&#160; I was going to mention a certain page on the Microsoft Support site.&#160; Here it is: <a title="Microsoft Support: How to identify your SQL Server version and edition" href="http://support.microsoft.com/kb/321185" target="_blank">How to identify your SQL Server version and edition</a>.</p>
<p>I think this page is a great reference in terms of versions.&#160; If someone wants to know what version of SQL Server he’s running and doesn’t know the version numbers, this is the place to be!&#160; I just whish that Microsoft would keep it more up-to-date.&#160; At this moment it’s not even mentioning SQL Server 2008 R2, while that was released about half a year ago.&#160; No sign of SP2 for SQL Server 2008 either.&#160; I’m going to provide feedback through the textbox at the bottom of the page with this exact statement.&#160; Hopefully that has some effect.</p>
<p>In case you are looking for those latest version numbers, here they are:</p>
<table border="0" cellspacing="0" cellpadding="2" width="400">
<tbody>
<tr>
<td valign="top" width="200"><strong>SQL Server 2008 SP2</strong></td>
<td valign="top" width="200">10.00.4000.00</td>
</tr>
<tr>
<td valign="top" width="200"><strong>SQL Server 2008 R2 RTM</strong></td>
<td valign="top" width="200">10.50.1600.1</td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2010%2F11%2F20%2Fserver-whats-your-version-number%2F&amp;title=Server%2C%20What%26rsquo%3Bs%20Your%20Version%20Number%3F" id="wpa2a_10"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/11/20/server-whats-your-version-number/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A Developer&#8217;s Excel: A Couple Of Tips</title>
		<link>http://blog.hoegaerden.be/2010/06/16/a-developers-excel-a-couple-of-tips/</link>
		<comments>http://blog.hoegaerden.be/2010/06/16/a-developers-excel-a-couple-of-tips/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 15:27:44 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Office]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Excel]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/06/16/a-developers-excel-a-couple-of-tips/</guid>
		<description><![CDATA[As a BI developer I regularly use Excel to analyze my data on correctness.  In Excel it’s easy to filter out unrelated records, as you’ll probably already know. How do I get my data in Excel? With a simple copy/paste.  Since SQL Server 2008, you can just right-click on the results in the Management Studio [...]]]></description>
			<content:encoded><![CDATA[<p>As a BI developer I regularly use Excel to analyze my data on correctness.  In Excel it’s easy to filter out unrelated records, as you’ll probably already know.</p>
<h2>How do I get my data in Excel?</h2>
<p>With a simple copy/paste.  Since SQL Server 2008, you can just right-click on the results in the Management Studio and select <em>Copy with Headers</em>.  This will put the selected data into memory, including the column headers.</p>
<p><img style="display: inline; border-width: 0px;" title="SSMS 2008: right-click on results to Copy with Headers" src="http://blog.hoegaerden.be/wp-content/uploads/image293.png" border="0" alt="SSMS 2008: right-click on results to Copy with Headers" width="449" height="256" /></p>
<p>You can even make a selection in the Results pane and only copy that, as shown in the screenshot above.  Here’s what it looks like when pasted into Excel:</p>
<p><img style="display: inline; border-width: 0px;" title="Data with headers pasted into Excel" src="http://blog.hoegaerden.be/wp-content/uploads/image294.png" border="0" alt="Data with headers pasted into Excel" width="347" height="114" /></p>
<h3>How do I make the columns wider?</h3>
<p>Excel will not expand the column widths by default, shown in that last screenshot.  You could manually enlarge them one by one, but that’s not convenient when you last filled column is called “DI”.  Instead, I use the following trick.  First I select the whole sheet by clicking on the grey square in the top-left corner:</p>
<p><img style="display: inline; border-width: 0px;" title="Select the whole sheet using the grey square" src="http://blog.hoegaerden.be/wp-content/uploads/image295.png" border="0" alt="Select the whole sheet using the grey square" width="360" height="149" /></p>
<p>Then I double-click on the vertical divider in between columns A and B.  This will adjust all column widths so that the data fits nicely.</p>
<p><img style="display: inline; border-width: 0px;" title="Double-click the divider in between two columns to adjust width automatically" src="http://blog.hoegaerden.be/wp-content/uploads/image296.png" border="0" alt="Double-click the divider in between two columns to adjust width automatically" width="626" height="116" /></p>
<h2>Does Excel know SELECT DISTINCT?</h2>
<p>The other day I needed to filter out all duplicate records out of a really large dataset.  I first tried by activating the regular filter.  This is an Excel feature that I use a lot.  Just clicking the <strong>Filter</strong> button on the Data ribbon will add the small dropdowns next to each column’s header:</p>
<p><img style="display: inline; border: 0px;" title="Excel's Filter functionality" src="http://blog.hoegaerden.be/wp-content/uploads/image297.png" border="0" alt="Excel's Filter functionality" width="661" height="289" /></p>
<p>But in those dropdowns I couldn’t find an option which would get me to the required result.</p>
<p>(Note that I added a couple of duplicate records in my dataset.)</p>
<p>After a little search, I found the magic checkbox!  I didn’t know that it could be so easy.</p>
<p>To find it, click the <strong>Advanced</strong> button in the Data ribbon.</p>
<p><img style="display: inline; border-width: 0px;" title="The Advanced button on the Data ribbon" src="http://blog.hoegaerden.be/wp-content/uploads/image298.png" border="0" alt="The Advanced button on the Data ribbon" width="389" height="131" /></p>
<p>In the <strong>Advanced Filter</strong> window that appears you see a checkbox called <em>Unique records only</em>.</p>
<p><img style="display: inline; border: 0px;" title="Advanced Filter: Unique records only checkbox" src="http://blog.hoegaerden.be/wp-content/uploads/image299.png" border="0" alt="Advanced Filter: Unique records only checkbox" width="239" height="242" /></p>
<p>There’s your SELECT DISTINCT!</p>
<p>And here’s the sheet with the duplicates filtered out:</p>
<p><img style="display: inline; border: 0px;" title="Excel sheet after filtering out duplicate records with the &quot;Unique records only&quot; option" src="http://blog.hoegaerden.be/wp-content/uploads/image300.png" border="0" alt="Excel sheet after filtering out duplicate records with the &quot;Unique records only&quot; option" width="659" height="117" /></p>
<p>Do you also see that the filter dropdowns are gone, although I did not remove them?  The Advanced Filter cannot be used in combination with the regular filter.  Once you activate the regular filter by clicking the Filter button, your duplicates will re-appear.</p>
<p>If you want to further filter your data after filtering out all duplicate records, you should select the <em>Copy to another location </em>option in the Advanced Filter window.  Copy it below your data on the same sheet and apply the regular filter on that new set of data.</p>
<p><img style="display: inline; border: 0px;" title="Filtered set of data below full dataset on same sheet" src="http://blog.hoegaerden.be/wp-content/uploads/image301.png" border="0" alt="Filtered set of data below full dataset on same sheet" width="664" height="411" /></p>
<p>Copying to another sheet is not supported.  Apparently you can only copy to the active sheet.  Should you try it out anyway, you’ll get this message:</p>
<p><img style="display: inline; border: 0px;" title="Warning: You can only copy filtered data to the active sheet" src="http://blog.hoegaerden.be/wp-content/uploads/image302.png" border="0" alt="Warning: You can only copy filtered data to the active sheet" width="342" height="121" /></p>
<p>Happy filtering!</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2010%2F06%2F16%2Fa-developers-excel-a-couple-of-tips%2F&amp;title=A%20Developer%26rsquo%3Bs%20Excel%3A%20A%20Couple%20Of%20Tips" id="wpa2a_12"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/06/16/a-developers-excel-a-couple-of-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Cooperation From A Stubborn Data Dude</title>
		<link>http://blog.hoegaerden.be/2010/06/09/getting-cooperation-from-a-stubborn-data-dude/</link>
		<comments>http://blog.hoegaerden.be/2010/06/09/getting-cooperation-from-a-stubborn-data-dude/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 19:59:49 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/06/09/getting-cooperation-from-a-stubborn-data-dude/</guid>
		<description><![CDATA[Lately I’ve been using Visual Studio Team System 2008 Database Edition with the GDR R2 add-on, also known as “The Data Dude”, to compare databases with each other. And during a schema compare I noticed that the dude can be quite stubborn now and then. Here’s an example and an explanation of why, as far [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I’ve been using <a title="Download: Microsoft® Visual Studio Team System 2008 Database Edition GDR R2" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bb3ad767-5f69-4db9-b1c9-8f55759846ed&amp;displaylang=en" target="_blank">Visual Studio Team System 2008 Database Edition with the GDR R2 add-on</a>, also known as “The Data Dude”, to compare databases with each other.</p>
<p>And during a schema compare I noticed that the dude can be quite stubborn now and then.</p>
<p>Here’s an example and an explanation of why, as far as I can tell, the dude is behaving that way.</p>
<h2>The Scenario</h2>
<p>At work we use the data dude’s schema compare to prepare our deployment scripts.  The most fun can be had when preparing a script to deploy the latest finalized version, <strong>version x</strong>, from the Development (DEV) to the Acceptance (UAT) environment.</p>
<p>In our DEV database there have already been changes for the next version, <strong>version x+1</strong>, so these changes need to be skipped.</p>
<p>Now imagine the following situation:</p>
<ul>
<li>a table called <em>TableA</em> exists</li>
<li>a new field called <em>NewFieldA</em> was added to <em>TableA</em></li>
<li>a view called <em>ViewA</em> exists and was modified – it uses <em>TableA</em> but not <em>NewFieldA</em></li>
</ul>
<p>The changes to <em>ViewA</em> belong with <strong>version x</strong>, while the changes to <em>TableA</em> are part of <strong>version x+1</strong>.  So the script that I’m going to generate should contain an ALTER VIEW ViewA … but not an ALTER TABLE TableA ….</p>
<h2>The Behavior</h2>
<p>Using the dude, I open up the dropdown on the line that states <em>Different definition </em>on <em>TableA</em> and I select <em>Skip</em>.  The value gets changed from <em>Update</em> to <em>Skip</em>.  However, when the focus changes to another line in the grid the value changes back to <em>Update</em>!  Furthermore, it’s now grayed out, impossible to change!</p>
<p>The first time that you see this happening you can’t believe your eyes and try it once more, first closing everything and then re-doing your actions.  Just to see if you didn’t select the wrong option somewhere.  But alas, the dude remains stubborn!</p>
<p><strong>Tip:</strong> if you have just executed the compare and you find that some update actions cannot be modified, try to do a refresh (right-click on the background of the comparison window and click Refresh).  I noticed that after the refresh you will get the dropdown for these lines and thus will be able to change the Update Action.</p>
<h2>The Explanation</h2>
<p>It took me a while to realize, but here’s what seems to be happening.  Like with all things stubborn, it helps if you know what the thing in question is actually being stubborn for.</p>
<p>The dude knows that <em>ViewA</em> depends on <em>TableA</em> and it also knows that both <em>ViewA</em> and <em>TableA</em> where changed.  However, the dude is a little short-sighted, it doesn’t know that <em>NewFieldA</em> is not used in <em>ViewA</em>.  It doesn’t know that the change to <em>ViewA</em> was not related to the change on <em>TableA</em>.  So it automatically assumes that you’re making a mistake and prevents you from messing up.  It thinks, “You stupid user, I know it better, I am smart software!  And that’s not all, I AM THE DATA DUDE! And if there’s one thing you don’t want, that’s to mess with the Data Dude!”.</p>
<p>Here’s a screenshot of the dude’s stubbornness:</p>
<p><img style="display: inline; border-width: 0px;" title="Grayed-out Update Action: the result of a stubborn data dude" src="http://blog.hoegaerden.be/wp-content/uploads/image291.png" border="0" alt="Grayed-out Update Action: the result of a stubborn data dude" width="105" height="182" /></p>
<p>In this particular case it refused to skip certain new tables, even though there were no dependent objects that needed those tables!  The first two lines show the grayed-out items.  These tables were located under a new schema and I had to put the schema’s <strong>Update Action</strong> to <em>Skip</em> to get the tables be skipped as well.  The Update Action for the tables was changed automatically when I modified the action for the schema.</p>
<p>But, if you ask me, I don’t see why I shouldn’t be able to <em>Skip</em> a new table even when I am going to create the new schema to which it belongs?  It’s the table that depends on the schema, not the other way around.</p>
<h2>The Feature Request</h2>
<p>It would have been great if I could manually override the dude’s decision.  As that was not the case, I have to manually change the generated script so that it only contains the changes that I want.  As long as it’s technically feasible, I think manual changes to the <strong>Update Action</strong> should be allowed.</p>
<h2>One More Tip</h2>
<p>Take a good look at the following screenshot.</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image292.png"><img style="display: inline; border: 0px;" title="Beware the miniature exclamation mark in the icon's corner!" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb70.png" border="0" alt="Beware the miniature exclamation mark in the icon's corner!" width="700" height="328" /></a></p>
<p>By default, the node that reads <em>Different dependencies</em> was collapsed.  So you think, good, the line says <em>Skip</em> so nothing will happen.  Except, did you notice that minuscule exclamation mark in the bottom-left corner of the icon?  That means that other actions may be happening further down the dependency tree, as illustrated in the screenshot.</p>
<p>So don’t let the dude mislead you into thinking nothing will happen when it says <em>Skip</em>.  Sometimes the actual actions are hidden further down and you need to open up every node with the exclamation mark on the icon to verify if that’s what you want.</p>
<p>Have fun training the dude,</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2010%2F06%2F09%2Fgetting-cooperation-from-a-stubborn-data-dude%2F&amp;title=Getting%20Cooperation%20From%20A%20Stubborn%20Data%20Dude" id="wpa2a_14"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/06/09/getting-cooperation-from-a-stubborn-data-dude/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Aggregating Data With The OVER Clause</title>
		<link>http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/</link>
		<comments>http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 21:12:01 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/</guid>
		<description><![CDATA[In this article I will show you a couple of different T-SQL queries to fetch aggregated data.  The main purpose is to illustrate how the OVER clause can be used to aggregate data. For the examples I will use data from the AdventureWorks2008R2 database, available at CodePlex. The Data The AdventureWorks 2008 R2 database contains [...]]]></description>
			<content:encoded><![CDATA[<p>In this article I will show you a couple of different T-SQL queries to fetch aggregated data.  The main purpose is to illustrate how the OVER clause can be used to aggregate data.</p>
<p>For the examples I will use data from the AdventureWorks2008R2 database, <a title="AdventureWorks 2008R2 RTM" href="http://msftdbprodsamples.codeplex.com/releases/view/45907" target="_blank">available at CodePlex</a>.</p>
<h2>The Data</h2>
<p>The AdventureWorks 2008 R2 database contains a view called <em>Sales.vSalesPerson</em>.  This is the data with which I’ll be working in the examples below.  Here’s what it looks like:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image286.png"><img style="display: inline; border-width: 0px;" title="My Working Data" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb68.png" border="0" alt="My Working Data" width="700" height="184" /></a></p>
<p>I’ve hidden some fields so that all the relevant ones are in view.</p>
<h2>The Scenario<a href="http://11011.net/software/vspaste"></a></h2>
<p>Your manager has asked you to create one query, to be executed on the <em>Sales.vSalesPerson</em> table, that returns a list of:</p>
<ul>
<li>all employees (FirstName, LastName, JobTitle, CountryRegionName, StateProvinceName, City),</li>
<li>their sales of last year (SalesLastYear),</li>
<li>the sum of the sales of last year for their country,</li>
<li>the average of the sales of last year compared to all employees with the same type of phone (PhoneNumberType)</li>
<li>the overall average and sum of the sales of last year.</li>
</ul>
<h3>Using Derived Tables</h3>
<p>No problem you say, coming right up.  So you start building your query, retrieving all fields as requested.</p>
<p>After quite some typing, here’s what your query looks like:</p>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<pre class="code"><span style="color: blue;">select </span>S<span style="color: gray;">.</span>FirstName<span style="color: gray;">, </span>S<span style="color: gray;">.</span>LastName<span style="color: gray;">, </span>S<span style="color: gray;">.</span>JobTitle<span style="color: gray;">, </span>S<span style="color: gray;">.</span>PhoneNumberType<span style="color: gray;">, </span>S<span style="color: gray;">.</span>CountryRegionName<span style="color: gray;">,
    </span>S<span style="color: gray;">.</span>StateProvinceName<span style="color: gray;">, </span>S<span style="color: gray;">.</span>City<span style="color: gray;">, </span>S<span style="color: gray;">.</span>SalesLastYear<span style="color: gray;">,
    </span>GeographicSales<span style="color: gray;">.</span>SalesLastYearGeographic_SUM<span style="color: gray;">,
    </span>SalesByPhoneType<span style="color: gray;">.</span>SalesLastYearByPhoneNumberType_AVG<span style="color: gray;">,
    </span>SalesSUM<span style="color: gray;">.</span>SalesLastYear_AVG<span style="color: gray;">, </span>SalesSUM<span style="color: gray;">.</span>SalesLastYear_SUM
<span style="color: blue;">from </span>Sales<span style="color: gray;">.</span>vSalesPerson S
<span style="color: green;">--Derived Table 1: the overall aggregates
</span><span style="color: gray;">cross join (
    </span><span style="color: blue;">select </span><span style="color: magenta;">SUM</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span>SalesLastYear_SUM<span style="color: gray;">, </span><span style="color: magenta;">AVG</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span>SalesLastYear_AVG
    <span style="color: blue;">from </span>Sales<span style="color: gray;">.</span>vSalesPerson
<span style="color: gray;">) </span>SalesSUM
<span style="color: green;">--Derived Table 2: the aggregate on Country level
</span><span style="color: gray;">inner join (
    </span><span style="color: blue;">select </span>CountryRegionName<span style="color: gray;">, </span><span style="color: magenta;">SUM</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span>SalesLastYearGeographic_SUM
    <span style="color: blue;">from </span>Sales<span style="color: gray;">.</span>vSalesPerson
    <span style="color: blue;">group by </span>CountryRegionName
<span style="color: gray;">) </span>GeographicSales <span style="color: blue;">on </span>GeographicSales<span style="color: gray;">.</span>CountryRegionName <span style="color: gray;">= </span>S<span style="color: gray;">.</span>CountryRegionName
<span style="color: green;">--Derived Table 3: the aggregate on phone type
</span><span style="color: gray;">inner join (
    </span><span style="color: blue;">select </span>PhoneNumberType<span style="color: gray;">, </span><span style="color: magenta;">AVG</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span>SalesLastYearByPhoneNumberType_AVG
    <span style="color: blue;">from </span>Sales<span style="color: gray;">.</span>vSalesPerson
    <span style="color: blue;">group by </span>PhoneNumberType
<span style="color: gray;">) </span>SalesByPhoneType <span style="color: blue;">on </span>SalesByPhoneType<span style="color: gray;">.</span>PhoneNumberType<span style="color: gray;">= </span>S<span style="color: gray;">.</span>PhoneNumberType<span style="color: gray;">;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>The main query is retrieving all fields as requested.  Further down there are three derived table queries, each one retrieving aggregates on a different level.</p>
<p>The first derived table is retrieving the overall aggregates.  These are cross-joined with every record in our main query so for each record the totals will be the same, which is what we want.</p>
<p>The second derived table retrieves the aggregates on Country level, including the CountryRegionName.  This is done using the conventional GROUP BY method.  The CountryRegionName is the key on which the derived table is joined to the main table.</p>
<p>The third derived table uses a similar system, this time for the aggregate on phone type.</p>
<p>And here’s the query’s output:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image287.png"><img style="display: inline; border-width: 0px;" title="Output of the query using subqueries" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb69.png" border="0" alt="Output of the query using subqueries" width="700" height="174" /></a></p>
<p>Happy with this result, you go up to the cafeteria to finally have lunch with your colleagues (who left 15 minutes earlier but you wanted to get your query finished first).</p>
<h3>Using The OVER Clause</h3>
<p>During lunch you explain to your peers what kind of funny request you got from management and told them how you solved it.</p>
<p>Then one of them speaks up and says: “Want to know how you can avoid all that typing?  Use the OVER clause!  I’ll show you when we are back at our desks.”</p>
<p>After lunch, here’s what your colleague helps to produce:</p>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<pre class="code"><span style="color: blue;">select </span>S<span style="color: gray;">.</span>FirstName<span style="color: gray;">, </span>S<span style="color: gray;">.</span>LastName<span style="color: gray;">, </span>S<span style="color: gray;">.</span>JobTitle<span style="color: gray;">, </span>S<span style="color: gray;">.</span>PhoneNumberType<span style="color: gray;">, </span>S<span style="color: gray;">.</span>CountryRegionName<span style="color: gray;">,
    </span>S<span style="color: gray;">.</span>StateProvinceName<span style="color: gray;">, </span>S<span style="color: gray;">.</span>City<span style="color: gray;">, </span>S<span style="color: gray;">.</span>SalesLastYear<span style="color: gray;">,
    </span><span style="color: magenta;">SUM</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span><span style="color: blue;">OVER </span><span style="color: gray;">(</span><span style="color: blue;">PARTITION BY </span>CountryRegionName<span style="color: gray;">)
        </span>SalesLastYearGeographic_SUM<span style="color: gray;">,
    </span><span style="color: magenta;">AVG</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span><span style="color: blue;">OVER </span><span style="color: gray;">(</span><span style="color: blue;">PARTITION BY </span>PhoneNumberType<span style="color: gray;">)
        </span>SalesLastYearByPhoneNumberType_AVG<span style="color: gray;">,
    </span>SalesSUM<span style="color: gray;">.</span>SalesLastYear_AVG<span style="color: gray;">, </span>SalesSUM<span style="color: gray;">.</span>SalesLastYear_SUM
<span style="color: blue;">from </span>Sales<span style="color: gray;">.</span>vSalesPerson S
<span style="color: green;">--Derived Table 1: the overall aggregates
</span><span style="color: gray;">cross join (
    </span><span style="color: blue;">select </span><span style="color: magenta;">SUM</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span>SalesLastYear_SUM<span style="color: gray;">, </span><span style="color: magenta;">AVG</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span>SalesLastYear_AVG
    <span style="color: blue;">from </span>Sales<span style="color: gray;">.</span>vSalesPerson
<span style="color: gray;">) </span>SalesSUM<span style="color: gray;">;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>As you can see, derived tables 2 and 3 are gone.  They have been replaced with <a title="OVER Clause (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms189461.aspx" target="_blank">the OVER clause</a>, in combination with PARTITION BY.  What you say with the OVER clause is: “partition the dataset by the fields specified in the PARTITION BY and apply the aggregation on those partitions”.  Another word for this is <strong>aggregate window function</strong>.</p>
<p>As you like the approach, you ask your co-worker how you can get rid of that cross join.  He doesn’t really know but then another colleague who overheard your conversation says: “On this blog the other day I read that you can use the OVER clause and partition by anything you want.  As long as it’s a constant, it will work!”.</p>
<p>So you give that a try and you end up with the following final query:</p>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<pre class="code"><span style="color: blue;">select </span>FirstName<span style="color: gray;">, </span>LastName<span style="color: gray;">, </span>JobTitle<span style="color: gray;">, </span>PhoneNumberType<span style="color: gray;">, </span>CountryRegionName<span style="color: gray;">,
    </span>StateProvinceName<span style="color: gray;">, </span>City<span style="color: gray;">, </span>SalesLastYear<span style="color: gray;">,
    </span><span style="color: magenta;">SUM</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span><span style="color: blue;">OVER </span><span style="color: gray;">(</span><span style="color: blue;">PARTITION BY </span>CountryRegionName<span style="color: gray;">)
        </span>SalesLastYearGeographic_SUM<span style="color: gray;">,
    </span><span style="color: magenta;">AVG</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span><span style="color: blue;">OVER </span><span style="color: gray;">(</span><span style="color: blue;">PARTITION BY </span>PhoneNumberType<span style="color: gray;">)
        </span>SalesLastYearByPhoneNumberType_AVG<span style="color: gray;">,
    </span><span style="color: magenta;">AVG</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span><span style="color: blue;">OVER </span><span style="color: gray;">(</span><span style="color: blue;">PARTITION BY </span><span style="color: red;">'duh'</span><span style="color: gray;">) </span>SalesLastYear_AVG<span style="color: gray;">,
    </span><span style="color: magenta;">SUM</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span><span style="color: blue;">OVER </span><span style="color: gray;">(</span><span style="color: blue;">PARTITION BY </span>1<span style="color: gray;">) </span>SalesLastYear_SUM
<span style="color: blue;">from </span>Sales<span style="color: gray;">.</span>vSalesPerson<span style="color: gray;">;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>As illustrated in the example, you can use any constant value to calculate overall aggregates over the whole dataset using the OVER clause.</p>
<p>You happily thank your colleagues and tell them that next time you’ll be able to join them for lunch on time.</p>
<p>About a week later you’re explaining to one of your friends how you’ve gotten to know the OVER clause. After hearing how you use it to aggregate over the whole dataset, he smiles and says: “I know how you can simplify it even more! Don’t partition at all!”.</p>
<p>Taking a closer look it turns out that the PARTITION BY is actually optional:</p>
<pre>Ranking Window Functions
&lt; OVER_CLAUSE &gt; :: =     OVER ( [ PARTITION BY value_expression, ... [ n ] ]            &lt;ORDER BY_Clause&gt; )Aggregate Window Functions
&lt; OVER_CLAUSE &gt; :: =     OVER ( [ PARTITION BY value_expression, ... [ n ] ] )</pre>
<p>See those square brackets? Means it’s optional.</p>
<p>So here is the real final query:</p>
<pre class="code"><span style="color: blue;">select </span>FirstName<span style="color: gray;">, </span>LastName<span style="color: gray;">, </span>JobTitle<span style="color: gray;">, </span>PhoneNumberType<span style="color: gray;">, </span>CountryRegionName<span style="color: gray;">,
    </span>StateProvinceName<span style="color: gray;">, </span>City<span style="color: gray;">, </span>SalesLastYear<span style="color: gray;">,
    </span><span style="color: magenta;">SUM</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span><span style="color: blue;">OVER </span><span style="color: gray;">(</span><span style="color: blue;">PARTITION BY </span>CountryRegionName<span style="color: gray;">)
        </span>SalesLastYearGeographic_SUM<span style="color: gray;">,
    </span><span style="color: magenta;">AVG</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span><span style="color: blue;">OVER </span><span style="color: gray;">(</span><span style="color: blue;">PARTITION BY </span>PhoneNumberType<span style="color: gray;">)
        </span>SalesLastYearByPhoneNumberType_AVG<span style="color: gray;">,
    </span><span style="color: magenta;">AVG</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span><span style="color: blue;">OVER </span><span style="color: gray;">() </span>SalesLastYear_AVG<span style="color: gray;">,
    </span><span style="color: magenta;">SUM</span><span style="color: gray;">(</span>SalesLastYear<span style="color: gray;">) </span><span style="color: blue;">OVER </span><span style="color: gray;">() </span>SalesLastYear_SUM
<span style="color: blue;">from </span>Sales<span style="color: gray;">.</span>vSalesPerson<span style="color: gray;">;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<h2>Conclusion</h2>
<p>When you compare the final query with the first one, tell me, which one would you prefer to maintain?  Do you prefer to have lunch with your peers or to arrive late and miss all the fun?</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><strong>References</strong></p>
<p><a title="The OVER Clause (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms189461.aspx" target="_blank">OVER Clause (Transact-SQL)</a></p>
<p><a title="Join Fundamentals" href="http://msdn.microsoft.com/en-us/library/ms191517.aspx" target="_blank">Join Fundamentals</a></p>
<p><a title="SELECT (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms189499.aspx" target="_blank">SELECT (Transact-SQL)</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2010%2F06%2F01%2Faggregating-data-with-the-over-clause%2F&amp;title=Aggregating%20Data%20With%20The%20OVER%20Clause" id="wpa2a_16"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Retrieving Data From Excel</title>
		<link>http://blog.hoegaerden.be/2010/03/29/retrieving-data-from-excel/</link>
		<comments>http://blog.hoegaerden.be/2010/03/29/retrieving-data-from-excel/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 20:16:53 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[T-SQL]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/03/29/retrieving-data-from-excel/</guid>
		<description><![CDATA[The purpose of this article is to demonstrate how to retrieve data from an Excel sheet and put it in a table in a SQL Server database. Introduction Anyone who&#8217;s ever used a computer for a significant amount of time has probably come into contact with Excel, the spreadsheet application part of the Microsoft Office [...]]]></description>
			<content:encoded><![CDATA[<p>The purpose of this article is to demonstrate how to retrieve data from an Excel sheet and put it in a table in a SQL Server database.</p>
<h2>Introduction</h2>
<p>Anyone who&#8217;s ever used a computer for a significant amount of time has probably come into contact with <a title="Excel 2007" href="http://office.microsoft.com/en-us/excel/default.aspx" target="_blank">Excel</a>, the spreadsheet application part of the Microsoft Office suite. Its main purposes are to perform calculations and create charts and pivot tables for analysis.</p>
<p>But people have great imagination and invent new uses for it every day.  I&#8217;ve even seen it used as a picture album.  (Sorry dad, but I know you won’t be reading this anyway. <img src='http://blog.hoegaerden.be/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> )  Ever since he had this specific YACI, or “Yet Another Computer Issue”, because his PC wasn’t powerful enough to open his 45 MB Excel file, uh, “picture collection”, he took some evening classes.  He’s now putting his Photoshopped pictures in PowerPoint…  Anyway, let’s get back on track now.</p>
<p>Another use, and the one that&#8217;s the subject of this article, is when Excel has been used as a database.  Come on, you know what I&#8217;m talking about, with the first row containing the column headers followed by possibly thousands of data rows.  The following screenshot contains an example, and is also the file that I will be using in this article.  I took all records from the <strong>Production.Product</strong> table in the <a title="AdventureWorks 2008R2 November CTP" href="http://msftdbprodsamples.codeplex.com/releases/view/24854" target="_blank">AdventureWorks 2008R2</a> database and dumped them in Excel.</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image206.png"><img style="display: inline; border-width: 0px;" title="An Excel sheet used as a data store" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb54.png" border="0" alt="An Excel sheet used as a data store" width="681" height="224" /></a></p>
<p>At some point people will realize, either because someone told them or because they lost some data due to inattentiveness, that it wasn&#8217;t a really good idea to keep all that data in an Excel sheet.  And they&#8217;ll ask you to put it in a real database such as SQL Server.</p>
<p>That&#8217;s what I&#8217;m going to show you in the next paragraphs: how to import data from Excel into SQL Server.</p>
<h2>Using OPENROWSET() To Query Excel Files</h2>
<p>There are actually several different ways to achieve this.  In this article I will use the <a title="BOL2008: OPENROWSET (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms190312.aspx" target="_blank">OPENROWSET()</a> function.  This is a T-SQL function that can be used to access any OLE DB data source.  All you need is the right OLE DB driver.  The oldest version which I could confirm that contains this function is SQL Server 7.0, good enough to say that any version supports it.</p>
<p>My sample Excel files are located in <em>C:\temp\</em>.  This folder contains two files:<em> Products.xls</em> and <em>Products.xlsx</em>.  The first file is saved in the old format, Excel 97-2003, while the second file was saved from Excel 2010.  Both files contain the same data.  The sheet containing the list of products is called <em>ProductList</em>.</p>
<p>And here are the queries:</p>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<pre class="code"><span style="color: green;">--Excel 2007-2010
</span><span style="color: blue;">SELECT </span><span style="color: gray;">* </span><span style="color: green;">--INTO #productlist
</span><span style="color: blue;">FROM OPENROWSET</span><span style="color: gray;">(</span><span style="color: red;">'Microsoft.ACE.OLEDB.12.0'</span><span style="color: gray;">,
    </span><span style="color: red;">'Excel 12.0 Xml;HDR=YES;Database=C:\temp\Products.xlsx'</span><span style="color: gray;">,
    </span><span style="color: red;">'SELECT * FROM [ProductList$]'</span><span style="color: gray;">);

</span><span style="color: green;">--Excel 97-2003
</span><span style="color: blue;">SELECT </span><span style="color: gray;">* </span><span style="color: green;">--INTO #productlist
</span><span style="color: blue;">FROM OPENROWSET</span><span style="color: gray;">(</span><span style="color: red;">'Microsoft.Jet.OLEDB.4.0'</span><span style="color: gray;">,
    </span><span style="color: red;">'Excel 8.0;HDR=YES;Database=C:\temp\Products.xls'</span><span style="color: gray;">,
    </span><span style="color: red;">'select * from [ProductList$]'</span><span style="color: gray;">);</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>These queries are just returning the data from the Excel file into the Results window, when executed using the Management Studio.  To insert the data into a table, uncomment the <a title="BOL2008: INTO Clause (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms188029.aspx" target="_blank">INTO</a> clause.  When uncommented, the statement retrieves the data from the Excel sheet and puts it into a newly-created <a title="BOL2008: Special Table Types" href="http://msdn.microsoft.com/en-us/library/ms186986.aspx" target="_blank">local temporary table</a> called <em>#productlist</em>.</p>
<p>Furthermore, the query assumes that the first row contains the header.  If that’s not the case, replace HDR=YES with HDR=NO.</p>
<p><strong>Note:</strong> if you get an error message when running the query, look further down in this article.  I’ve covered a couple of them.</p>
<p>With the INTO clause uncommented and the query executed, the temporary table can now be queried just like any other table:</p>
<pre class="code"><span style="color: blue;">SELECT </span><span style="color: gray;">* </span><span style="color: blue;">FROM </span>#productlist</pre>
<h3>What Type Is Your Data?</h3>
<p>Let’s have a look if this method of using a SELECT INTO in combination with OPENROWSET and a temporary table is smart enough to interpret the correct data types of the data coming in.  Use the following command to describe the metadata of the temporary table:</p>
<pre class="code"><span style="color: blue;">USE </span>tempdb<span style="color: gray;">;
</span><span style="color: blue;">GO
</span><span style="color: maroon;">sp_help </span><span style="color: red;">'#productlist'</span><span style="color: gray;">;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>Because a temporary table is stored in the <em>tempdb</em>, the <a title="BOL2008: sp_helptext (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms176112.aspx" target="_blank">sp_help</a> command should be issued against that database.</p>
<p>Here’s the part of the output in which we’re interested:</p>
<p><img style="display: inline; border-width: 0px;" title="The data types used when combining OPENROWSET with SELECT INTO" src="http://blog.hoegaerden.be/wp-content/uploads/image207.png" border="0" alt="The data types used when combining OPENROWSET with SELECT INTO" width="377" height="442" /></p>
<p>As you can see, anything that looks like text will be put in a field of type<em> nvarchar(510)</em> and anything that looks like a number (integers, floating-point numbers, datetime values, …) is put into a <em>float(53)</em>.  Not a lot of intelligence there.  This is the result when no formatting was put on the cells in Excel.</p>
<p>As an experiment I’ve changed the format of some fields in the Excel file and then retried the SELECT INTO statement.  What did I change?  I identified <em>ProductID</em> as being a number without any decimals, changed <em>StandardCost</em> and <em>ListPrice</em> to a currency with four decimal digits and I changed <em>SellStartDate</em> and <em>SellEndDate</em> to a custom date/time format showing both date and time.</p>
<p>The effect on the table creation was not completely as I would have expected:</p>
<p><img style="display: inline; border-width: 0px;" title="SELECT INTO with some field types changed" src="http://blog.hoegaerden.be/wp-content/uploads/image208.png" border="0" alt="SELECT INTO with some field types changed" width="382" height="446" /></p>
<p><em>ProductID</em> is still being stored into a float field, even though in Excel it’s defined as having no decimals.  And the datetime values are not recognized either.  Okay, I used a custom format there, so maybe it’s due to that.</p>
<p>It’s up to you of course how you use this method of importing the data.  You can put your records into a temporary table to process further, or you can create a table with the expected data types upfront and import the data directly into that one.</p>
<h2>Some Possible Issues</h2>
<p>Let’s cover some issues related to this method.</p>
<h3>Enable ‘AD Hoc Distributed Queries’</h3>
<p>The OPENROWSET() function expects that the <a title="BOL2008: ad hoc distributed queries Option" href="http://msdn.microsoft.com/en-us/library/ms187569.aspx" target="_blank">‘Ad Hoc Distributed Queries’ option</a> is enabled on the server.  When that’s not the case you’ll see the following message:</p>
<blockquote><p><span style="color: #ff0000;">Msg 15281, Level 16, State 1, Line 1</span></p>
<p><span style="color: #ff0000;">SQL Server blocked access to STATEMENT &#8216;OpenRowset/OpenDatasource&#8217; of component &#8216;Ad Hoc Distributed Queries&#8217; because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of &#8216;Ad Hoc Distributed Queries&#8217; by using sp_configure. For more information about enabling &#8216;Ad Hoc Distributed Queries&#8217;, see &#8220;Surface Area Configuration&#8221; in SQL Server Books Online.</span></p></blockquote>
<p>This is one of the advanced options.  To enable it you can use the following command:</p>
<pre class="code"><span style="color: maroon;">sp_configure </span><span style="color: red;">'show advanced options'</span><span style="color: gray;">, </span>1<span style="color: gray;">;
</span><span style="color: blue;">GO
RECONFIGURE</span><span style="color: gray;">;
</span><span style="color: blue;">GO

</span><span style="color: maroon;">sp_configure </span><span style="color: red;">'Ad Hoc Distributed Queries'</span><span style="color: gray;">, </span>1<span style="color: gray;">;
</span><span style="color: blue;">GO
RECONFIGURE</span><span style="color: gray;">;
</span><span style="color: blue;">GO</span></pre>
<p>To get a good look at all the different settings, just run the <a title="BOL2008: sp_configure (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms188787.aspx" target="_blank">sp_configure</a> procedure without any parameters.</p>
<p><strong>Note:</strong> if you’re not the administrator of the server, you should talk to the DBA who’s responsible before attempting this.</p>
<h3>The File Needs To Be Closed</h3>
<p>When the Excel file is not closed, you’ll end up with the following error:</p>
<blockquote><p><span style="color: #ff0000;">Msg 7399, Level 16, State 1, Line 1</span></p>
<p><span style="color: #ff0000;">The OLE DB provider &#8220;Microsoft.Jet.OLEDB.4.0&#8243; for linked server &#8220;(null)&#8221; reported an error. The provider did not give any information about the error.</span></p>
<p><span style="color: #ff0000;">Msg 7303, Level 16, State 1, Line 1 </span></p>
<p><span style="color: #ff0000;">Cannot initialize the data source object of OLE DB provider &#8220;Microsoft.Jet.OLEDB.4.0&#8243; for linked server &#8220;(null)&#8221;.</span></p></blockquote>
<p>So close the file and try the query again.</p>
<h3>OLE DB Driver Not Installed</h3>
<p>The OPENROWSET() function uses OLE DB, so it needs a driver for your data source, in this case for Excel.  If the right driver is not installed, you’ll see the following error (or similar, depends on the version used).</p>
<blockquote><p><span style="color: #ff0000;">Msg 7302, Level 16, State 1, Line 1</span></p>
<p><span style="color: #ff0000;">Cannot create an instance of OLE DB provider &#8220;Microsoft.ACE.OLEDB.12.0&#8243; for linked server &#8220;(null)&#8221;.</span></p></blockquote>
<p>To solve the issue, install the right driver and try again.</p>
<p>How can you tell what drivers are installed?  Open up the <strong>ODBC Data Source Administrator</strong> window (Start &gt; Run &gt; type ODBCAD32.EXE and enter) and have a look in the <em>Drivers</em> tab.  The following screenshot (taken on a Dutch Windows XP) shows both the JET 4.0 driver for Excel 97-2003 and the fairly-new ACE driver for Excel 2007.</p>
<p><img style="display: inline; border-width: 0px;" title="odbcad32.exe - ODBC Data Source Administrator" src="http://blog.hoegaerden.be/wp-content/uploads/image209.png" border="0" alt="odbcad32.exe - ODBC Data Source Administrator" width="461" height="415" /></p>
<p>The drivers can be downloaded from the following pages on the Microsoft site:</p>
<p><a title="How to obtain the latest service pack for the Microsoft Jet 4.0 Database Engine" href="http://support.microsoft.com/kb/239114/" target="_blank">Excel 97-2003 Jet 4.0 driver</a></p>
<p><a title="2007 Office System Driver: Data Connectivity Components" href="http://www.microsoft.com/downloads/details.aspx?familyid=7554F536-8C28-4598-9B72-EF94E038C891&amp;displaylang=en" target="_blank">Excel 2007 ACE driver &#8211; 12.00.6423.1000</a></p>
<p><a title="2010 Office System Driver Beta: Data Connectivity Components" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=C06B8369-60DD-4B64-A44B-84B371EDE16D&amp;displaylang=en" target="_blank">Excel 2010 ACE driver (beta) &#8211; 14.00.4732.1000</a></p>
<p><strong>Sidenote:</strong> the Excel 2010 driver is not supported on Windows XP, but I was able to query the 2010 Excel sheet using the 2007 driver.  I guess that this is the result of the <a title="Wikipedia: Office Open XML" href="http://en.wikipedia.org/wiki/Office_Open_XML" target="_blank">Office Open XML standard</a> which was introduced in Office 2007.</p>
<p><strong>Driver backward-compatibility</strong></p>
<p>The ACE drivers are backwards-compatible.  So the following queries are working perfectly:</p>
<pre class="code"><span style="color: green;">--old Excel with new ACE driver - working query 1
</span><span style="color: blue;">SELECT </span><span style="color: gray;">* </span><span style="color: green;">--INTO #productlist
</span><span style="color: blue;">FROM OPENROWSET</span><span style="color: gray;">(</span><span style="color: red;">'Microsoft.ACE.OLEDB.12.0'</span><span style="color: gray;">,
    </span><span style="color: red;">'Excel 8.0;HDR=YES;Database=C:\temp\Products.xls'</span><span style="color: gray;">,
    </span><span style="color: red;">'SELECT * FROM [ProductList$]'</span><span style="color: gray;">);

</span><span style="color: green;">--old Excel with new ACE driver - working query 2
</span><span style="color: blue;">SELECT </span><span style="color: gray;">* </span><span style="color: green;">--INTO #productlist
</span><span style="color: blue;">FROM OPENROWSET</span><span style="color: gray;">(</span><span style="color: red;">'Microsoft.ACE.OLEDB.12.0'</span><span style="color: gray;">,
    </span><span style="color: red;">'Excel 12.0;HDR=YES;Database=C:\temp\Products.xls'</span><span style="color: gray;">,
    </span><span style="color: red;">'SELECT * FROM [ProductList$]'</span><span style="color: gray;">);</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>In other words, you won’t be needing that first link for the Jet driver.  For the full story have a look at <a title="How to get a x64 version of Jet?" href="http://blogs.msdn.com/psssql/archive/2010/01/21/how-to-get-a-x64-version-of-jet.aspx" target="_blank">this blog post by Adam Saxton</a> of the CSS SQL Server Escalation Services team.</p>
<h3>The 64-bit Story</h3>
<p>So, what if you’re running a 64-bit OS?  I’ll start by saying that I had quite some issues getting OPENROWSET to work, but finally I managed it.  Following is a list of my attempts, each time with the resulting message.  And finally I’ll show you how I got it to work.  The problem was something really unexpected…</p>
<p><strong>ACE 14 64-bit through SSMS</strong></p>
<p>My main laptop is running Windows 7 64-bit, Office 2010 64-bit and SQL Server 2008 R2 64-bit.  So I installed the 64-bit version of the ACE 14 driver, which happens to be the first OLE DB driver for Excel that ships in 64-bit.  But when I execute my query I’m getting the following message:</p>
<blockquote><p><span style="color: #ff0000;">Msg 7403, Level 16, State 1, Line 1</span></p>
<p><span style="color: #ff0000;">The OLE DB provider &#8220;Microsoft.ACE.OLEDB.14.0&#8243; has not been registered.</span></p></blockquote>
<p>Is this because SSMS ships only in 32-bit?  Maybe, but I’m not able to install the 32-bit driver.  It doesn’t allow me to because I’ve got Office in 64-bit installed.  The installer throws me the following error:</p>
<p><img style="display: inline; border-width: 0px;" title="Microsoft Access database engine 2010 (beta) - You cannot install the 32-bit version of Access Database engine for Microsoft Office 2010 because you currently have 64-bit Office products installed..." src="http://blog.hoegaerden.be/wp-content/uploads/image210.png" border="0" alt="Microsoft Access database engine 2010 (beta) - You cannot install the 32-bit version of Access Database engine for Microsoft Office 2010 because you currently have 64-bit Office products installed..." width="416" height="218" /></p>
<p><strong>ACE 12 32-bit on a 64-bit machine</strong></p>
<p>When I check the installed drivers using the 32-bit version of the ODBC Data Source Administrator (located in C:\Windows\SysWOW64), I notice that the ACE 12 driver is installed.  However, trying to use that one from the Management Studio gives me this:</p>
<blockquote><p><span style="color: #ff0000;">Msg 7399, Level 16, State 1, Line 1</span></p>
<p><span style="color: #ff0000;">The OLE DB provider &#8220;Microsoft.ACE.OLEDB.12.0&#8243; for linked server &#8220;(null)&#8221; reported an error. The provider did not give any information about the error.</span></p>
<p><span style="color: #ff0000;">Msg 7330, Level 16, State 2, Line 1 </span></p>
<p><span style="color: #ff0000;">Cannot fetch a row from OLE DB provider &#8220;Microsoft.ACE.OLEDB.12.0&#8243; for linked server &#8220;(null)&#8221;.</span></p></blockquote>
<p>The Results pane shows all the columns with the right column names, retrieved from Excel.  But the driver seems to have a problem retrieving the actual data.</p>
<p>This issue with error 7330 is mentioned <a title="OPENROWSET with Excel 2007 -- 7330 Cannot fetch a row from OLE DB provider &quot;Microsoft.ACE.OLEDB.12.0&quot; for linked server &quot;(null)&quot;" href="http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/8514b4bb-945a-423b-98fe-a4ec4d7366ea" target="_blank">in the following thread</a> on the SQL Server MSDN forum, but unfortunately the proposed solution didn’t solve the problem in my case.</p>
<p><strong>64-bit SQLCMD using ACE 14 driver</strong></p>
<p>I also tried using the 64-bit version of <a title="BOL2008: sqlcmd Utility" href="http://msdn.microsoft.com/en-us/library/ms162773.aspx" target="_blank">sqlcmd.exe</a>, but strangely enough that throws the same error.</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image211.png"><img style="display: inline; border-width: 0px;" title="Using sqlcmd 64-bit to query Excel" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb55.png" border="0" alt="Using sqlcmd 64-bit to query Excel" width="688" height="377" /></a></p>
<p>I actually expected this last method to work, after all, everything is now running in 64-bit.  But alas, it didn’t…</p>
<p><strong>One more go…</strong></p>
<p>After some more trial and error, I have actually found a way to get the query to work.  I don’t have a logical explanation on why it’s behaving the way it is, but, well, it is working…</p>
<p>This query is running fine:</p>
<pre class="code"><span style="color: blue;">SELECT </span><span style="color: gray;">* </span><span style="color: green;">--INTO #productlist
</span><span style="color: blue;">FROM OPENROWSET</span><span style="color: gray;">(</span><span style="color: red;">'Microsoft.ACE.OLEDB.12.0'</span><span style="color: gray;">,
    </span><span style="color: red;">'Excel 12.0 Xml;HDR=YES;Database=C:\temp\Products.xlsx'</span><span style="color: gray;">,
    </span><span style="color: red;">'SELECT * FROM [ProductList$]'</span><span style="color: gray;">);</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>But this one isn’t:</p>
<pre class="code"><span style="color: green;">--Excel 2007-2010
</span><span style="color: blue;">SELECT </span><span style="color: gray;">* </span><span style="color: green;">--INTO #productlist
</span><span style="color: blue;">FROM OPENROWSET</span><span style="color: gray;">(</span><span style="color: red;">'Microsoft.ACE.OLEDB.12.0'</span><span style="color: gray;">,
    </span><span style="color: red;">'Excel 12.0 Xml;HDR=YES;Database=C:\temp\Products.xlsx'</span><span style="color: gray;">,
    </span><span style="color: red;">'SELECT * FROM [ProductList$]'</span><span style="color: gray;">);</span></pre>
<p>It’s exactly the same query, only difference is the comment line at the start.  And even weirder, if I add a space after the double-dash, the query works fine as well!</p>
<p>Then I decided to remove the commented INTO clause.  This made the weird behavior disappear.  So for some reason SQL Server doesn’t like the OPENROWSET function combined with comments inside the query.  The strange behavior also disappears when a space is added between the double-dash and the INTO keyword.</p>
<p>Uh, computers can be so much fun, right? <img src='http://blog.hoegaerden.be/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>If anyone has got an explanation on this strange behavior: please do post a comment!  For now my conclusion is: don’t use comments when creating an OPENROWSET query.</p>
<p><strong><span style="text-decoration: underline;">IMPORTANT UPDATE (April 11, 2010)</span>: it seems that the current installer for the ACE 14 driver contains a bug and registers it as being “Microsoft.ACE.OLEDB.12.0” instead of “Microsoft.ACE.OLEDB.14.0” .  This explains some of the issues shown above.  Some evidence on the issue:</strong></p>
<p><strong><a title="Access Database Engine 2010 installation issue to use with ADO access technology to access data from Jet database (.mdb files)" href="https://connect.microsoft.com/data/feedback/details/541090/access-database-engine-2010-installation-issue-to-use-with-ado-access-technology-to-access-data-from-jet-database-mdb-files?wa=wsignin1.0" target="_blank">Microsoft Connect: Access Database Engine 2010 installation issue to use with ADO access technology to access data from Jet database (.mdb files)</a></strong></p>
<p><strong><a title="The 'Microsoft.ACE.OLEDB.14.0' provider is not registered ....." href="http://forums.devarticles.com/microsoft-access-development-49/the-microsoft-ace-oledb-14-0-provider-is-not-registered-238601.html" target="_blank">The &#8216;Microsoft.ACE.OLEDB.14.0&#8242; provider is not registered &#8230;.. (see last comment)</a></strong></p>
<p><strong><a title="Excel Services, ODC and Microsoft.ACE.OLEDB.14.0" href="http://blog.sharepointalist.com/2010/03/odc-microsoft-ace-oledb-14-0.html" target="_blank">Excel Services, ODC and Microsoft.ACE.OLEDB.14.0</a></strong></p>
<h2>Conclusion</h2>
<p>The above has shown that OPENROWSET() can be a useful function, given the right circumstances.  But in the wrong setting it can be quite cumbersome to get to work.</p>
<p>I would recommend this method only for one-off quick imports, such as when you as a developer are given a bunch of data in a spreadsheet and need to get it into the database, one way or another.  I would not use it for an automated import process.  For that we’ve got a more interesting alternative which I’ll cover <a title="Importing Excel Data Using Integration Services" href="http://blog.hoegaerden.be/2010/04/20/importing-excel-data-using-integration-services/">in an upcoming article</a>.</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><strong>References</strong></p>
<p><a title="BOL 2008: Special Table Types" href="http://msdn.microsoft.com/en-us/library/ms186986.aspx" target="_blank">BOL 2008: Special Table Types (incl. temporary tables)</a></p>
<p><a title="BOL 2008: OPENROWSET() function" href="http://msdn.microsoft.com/en-us/library/ms190312.aspx" target="_blank">BOL 2008: OPENROWSET() function</a></p>
<p><a title="BOL 2008: the INTO clause" href="http://msdn.microsoft.com/en-us/library/ms188029.aspx" target="_blank">BOL 2008: the INTO clause</a></p>
<p><a title="How to get a x64 version of Jet?" href="http://blogs.msdn.com/psssql/archive/2010/01/21/how-to-get-a-x64-version-of-jet.aspx" target="_blank">CSS SQL Server Engineers: How to get a x64 version of Jet?</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2010%2F03%2F29%2Fretrieving-data-from-excel%2F&amp;title=Retrieving%20Data%20From%20Excel" id="wpa2a_18"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/03/29/retrieving-data-from-excel/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>SQL Server 2008 SP2: Want It? Vote For It!</title>
		<link>http://blog.hoegaerden.be/2010/01/20/sql-server-2008-sp2-want-it-vote-for-it/</link>
		<comments>http://blog.hoegaerden.be/2010/01/20/sql-server-2008-sp2-want-it-vote-for-it/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 21:29:52 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/01/20/sql-server-2008-sp2-want-it-vote-for-it/</guid>
		<description><![CDATA[If you’re interested in seeing the next Service Pack for SQL Server 2008 released, vote for it at this Microsoft Connect page!&#160; Now that the release date for R2 has been announced, hopefully the next one is for SQL 2008 Service Pack 2. If you’re still on 2005 and thus more interested in an SP4 [...]]]></description>
			<content:encoded><![CDATA[<p>If you’re interested in seeing the next Service Pack for SQL Server 2008 released, <a title="Microsoft Connect: SQL Server 2008 Service Pack 2" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=522123">vote for it at this Microsoft Connect page</a>!&#160; Now that the release date for R2 has been announced, hopefully the next one is for SQL 2008 Service Pack 2.</p>
<p>If you’re still on 2005 and thus more interested in an SP4 for that version, <a title="Microsoft Connect: Service Pack 4 for SQL Server 2005" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=522122">it has also been posted at Connect</a>.</p>
<p>How did I find out?&#160; Through the following blog posts at SSQA.NET:</p>
<p><a title="SQL Server 2008 SP2" href="http://sqlserver-qa.net/blogs/sql2008/archive/2010/01/14/6210.aspx">SQL Server 2008 SP2</a></p>
<p><a title="SQL Server 2005 SP4" href="http://sqlserver-qa.net/blogs/sql2008/archive/2010/01/14/6211.aspx">SQL Server 2005 SP4</a></p>
<p><strong>Update (27 Feb 2010):</strong></p>
<p>SQL Server 2008 SP2 is scheduled for Q3 2010.</p>
<p>SQL Server 2005 SP4 is scheduled for Q4 2010.</p>
<p><a title="SQL Server Servicing plans" href="http://blogs.msdn.com/sqlreleaseservices/archive/2010/02/12/sql-server-servicing-plans.aspx" target="_blank">See this post on the Microsoft SQL Server Release Services blog</a> for details.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2010%2F01%2F20%2Fsql-server-2008-sp2-want-it-vote-for-it%2F&amp;title=SQL%20Server%202008%20SP2%3A%20Want%20It%3F%20Vote%20For%20It%21" id="wpa2a_20"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2010/01/20/sql-server-2008-sp2-want-it-vote-for-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

