<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2" -->
<?xml-stylesheet title="XSL_formatting" type="text/xsl" href="rss.xsl"?>
<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/"
	>

<channel>
	<title>I can't remember where I read it....</title>
	<link>http://www.adrianbanks.co.uk</link>
	<description>a collection of online post-it notes</description>
	<pubDate>Thu, 10 Jun 2010 22:52:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2</generator>
	<language>en</language>
			<item>
		<title>Temporarily Disabling ReSharper</title>
		<link>http://www.adrianbanks.co.uk/?p=66</link>
		<comments>http://www.adrianbanks.co.uk/?p=66#comments</comments>
		<pubDate>Thu, 10 Jun 2010 22:52:13 +0000</pubDate>
		<dc:creator>Adrian Banks</dc:creator>
		
		<category><![CDATA[ReSharper]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<category><![CDATA[.Net]]></category>

		<guid isPermaLink="false">http://www.adrianbanks.co.uk/?p=66</guid>
		<description><![CDATA[I have ReSharper installed and think it is a great tool for productivity, but occasionally I find it useful to temporarily disable it to speed up Visual Studio (especially so on my old slow laptop). This is achieved in two different ways, depending on the version of ReSharper.
In versions prior to version 5, ReSharper appears in [...]]]></description>
			<content:encoded><![CDATA[<p>I have <a href="http://www.jetbrains.com/resharper/" title="JetBrains ReSharper Website">ReSharper</a> installed and think it is a great tool for productivity, but occasionally I find it useful to temporarily disable it to speed up Visual Studio (especially so on my old slow laptop). This is achieved in two different ways, depending on the version of ReSharper.</p>
<p>In versions prior to version 5, ReSharper appears in the Add-in Manager dialog, accessed via the Tools menu. Using this dialog, you can uncheck the ReSharper add-in which will suspend it (the menu will still be visible, but its functionality will be disabled).</p>
<p><img src="http://www.adrianbanks.co.uk/wp-content/uploads/2010/06/resharperpre5suspend.jpg" alt="Suspending ReSharper v4" title="Suspending ReSharper v4" /></p>
<p>Checking it again will re-enable it. Both of these actions can be performed without restarting Visual Studio.</p>
<p>In version 5, ReSharper no longer appears in the add-ins dialog. At first glance, I though the ability to disable ReSharper was no longer available. As it turns out, it is now part of ReSharper itself and is accessed via the Tools -&gt; Options -&gt; ReSharper -&gt; General dialog. Clicking the suspend button will suspend ReSharper and disable its functionality. Once suspended, clicking the resume button will re-enable it.</p>
<p><img src="http://www.adrianbanks.co.uk/wp-content/uploads/2010/06/resharper5suspend.jpg" alt="Suspending ReSharper v5" title="Suspending ReSharper v5" /></p>
<p>This applies to all versions of Visual Studio - the difference is based on the version of ReSharper only.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adrianbanks.co.uk/?feed=rss2&amp;p=66</wfw:commentRss>
		</item>
		<item>
		<title>Extracting MSI Files (Revisited)</title>
		<link>http://www.adrianbanks.co.uk/?p=64</link>
		<comments>http://www.adrianbanks.co.uk/?p=64#comments</comments>
		<pubDate>Thu, 29 Oct 2009 22:47:22 +0000</pubDate>
		<dc:creator>Adrian Banks</dc:creator>
		
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.adrianbanks.co.uk/?p=64</guid>
		<description><![CDATA[A few years ago, I posted about how to extract the contents of an MSI file without having to go through the process of installing it. The tool used to do this was called Less MSIèrables. This tool does do the job, but the UI is a bit clunky to use, it has a few [...]]]></description>
			<content:encoded><![CDATA[<p>A few years ago, I <a href="http://www.adrianbanks.co.uk/?p=20" title="Extracting MSI Files">posted</a> about how to extract the contents of an MSI file without having to go through the process of installing it. The tool used to do this was called <a href="http://blogs.pingpoet.com/overflow/archive/2005/06/02/2449.aspx" title="Less MSIèrables">Less MSIèrables</a>. This tool does do the job, but the UI is a bit clunky to use, it has a few bugs, and occasionally fails to extract the contents of a file. On top of this, it looks like this tool is not actively developed (it was last updated in 2005), so I recently started to look for an alternative.</p>
<p>It turns out that Microsoft provide this functionality as part of MSIExec that comes as part of the Windows installer. To extract the contents of any MSI file, simply run the following:</p>
<div class="syntax_hilite">
<div id="code-2">
msiexec.<span style="">exe</span> /a installer.<span style="">msi</span> /qb TARGETDIR=C:\temp
</div>
</div>
<p></p>
<p>This will extract the complete contents of the MSI file to the specified directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adrianbanks.co.uk/?feed=rss2&amp;p=64</wfw:commentRss>
		</item>
		<item>
		<title>MSDN Lightweight View</title>
		<link>http://www.adrianbanks.co.uk/?p=62</link>
		<comments>http://www.adrianbanks.co.uk/?p=62#comments</comments>
		<pubDate>Tue, 07 Jul 2009 21:25:52 +0000</pubDate>
		<dc:creator>Adrian Banks</dc:creator>
		
		<category><![CDATA[Tips]]></category>

		<category><![CDATA[MSDN]]></category>

		<guid isPermaLink="false">http://www.adrianbanks.co.uk/?p=62</guid>
		<description><![CDATA[Following on from my last post on the MDSN Low Bandwidth View, Scott Hanselman recently tweeted about the beta version of MDSN Lightweight View.
In a similar way to adding (loband) before the .aspx part of the url, putting (lightweight) before the .aspx part of the url will use the new lightweight view of MSDN, meaning [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from my last post on the <a href="http://www.adrianbanks.co.uk/?p=61" title="MDSN Low Bandwidth View">MDSN Low Bandwidth View</a>, <a href="http://www.hanselman.com/blog/" title="Scott Hanselman's Blog">Scott Hanselman</a> recently <a href="http://twitter.com/shanselman/status/2428774227" title="Sneakpeek of LightWeight MSDN. Not Done yet, coming soon.">tweeted</a> about the beta version of MDSN Lightweight View.</p>
<p>In a similar way to adding (loband) before the .aspx part of the url, putting (lightweight) before the .aspx part of the url will use the new lightweight view of MSDN, meaning a much neater and streamlined version.</p>
<p>In addition, Scott has previously <a href="http://www.hanselman.com/blog/LowBandwidthViewAndOtherHiddenAndFutureFeaturesOfMSDN.aspx" title="Scott Hanselman's Blog">posted</a> about the other modes of MSDN:</p>
<table class="posttable" cellpadding="4" cellspacing="0">
<tr>
<th>Mode</th>
<th>Description</th>
<th>Example</th>
</tr>
<tr>
<td>-</td>
<td>The normal MSDN view.</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.object.aspx">Example</a></td>
<tr>
<td>(loband)</td>
<td>A minimal view, focussed on speed.</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.object(loband).aspx">Example</a></td>
</tr>
<tr>
<td>(lightweight)</td>
<td>A faster lightweight view, including quick links to switch between languages and .Net framework versions.</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.object(lightweight).aspx">Example</a></td>
</tr>
<tr>
<td>(pda)</td>
<td>Aimed at PDAs and phones. Turns off the tree and allows a 100% width.</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.object(pda).aspx">Example</a></td>
</tr>
<tr>
<td>(robot)</td>
<td>Optimised for search engines.</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.object(robot).aspx">Example</a></td>
</tr>
<tr>
<td>(printer)</td>
<td>A printable version.</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.object(printer).aspx">Example</a></td>
</tr>
<tr>
<td>(ide)</td>
<td>Used when viewing inside the IDE. Adds send and give feedback links.</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.object(ide).aspx">Example</a></td>
</tr>
</table>
<p><br/><br />
<em>Note that the dev10ide view Scott mentions seems to have been removed, and that the lightweight view is currently in beta, so may be liable to change.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adrianbanks.co.uk/?feed=rss2&amp;p=62</wfw:commentRss>
		</item>
		<item>
		<title>MSDN Low Bandwidth View</title>
		<link>http://www.adrianbanks.co.uk/?p=61</link>
		<comments>http://www.adrianbanks.co.uk/?p=61#comments</comments>
		<pubDate>Wed, 08 Apr 2009 22:08:55 +0000</pubDate>
		<dc:creator>Adrian Banks</dc:creator>
		
		<category><![CDATA[Tips]]></category>

		<category><![CDATA[MSDN]]></category>

		<guid isPermaLink="false">http://www.adrianbanks.co.uk/?p=61</guid>
		<description><![CDATA[Several months ago, I read a tip about passing an extra parameter on the url to MSDN documentation to put it into "low bandwidth" mode. I remember doing it at the time, but almost immediately forgot the url switch. That was until last week when I read Eric Nelson's post on how to do it.
The [...]]]></description>
			<content:encoded><![CDATA[<p>Several months ago, I read a tip about passing an extra parameter on the url to MSDN documentation to put it into "low bandwidth" mode. I remember doing it at the time, but almost immediately forgot the url switch. That was until last week when I read <a href="http://blogs.msdn.com/ericnel" title="Eric Nelson's Blog">Eric Nelson</a>'s <a href="http://blogs.msdn.com/ericnel/archive/2009/04/02/msdn-library-low-bandwidth-option.aspx" title="Eric Nelson's Blog">post</a> on how to do it.</p>
<p>The trick is to put (loband) before the .aspx part of the url. For example, the low bandwidth version of</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.object.aspx">http://msdn.microsoft.com/en-us/library/system.object.aspx</a></p>
<p>becomes</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.object(loband).aspx">http://msdn.microsoft.com/en-us/library/system.object(loband).aspx</a></p>
<p>Once you have accessed it, you can persist it by clicking on the "Persist low bandwidth view" link.</p>
<p>Since Eric wrote his post, it seems that a "Switch on low bandwidth view" link has been added into the normal MSDN pages to enable it to be switched on without hacking around with the url.</p>
<p><a href="http://weblogs.asp.net/jgalloway" title="Jon Galloway's Blog">Jon Galloway</a> has a <a href="http://weblogs.asp.net/jgalloway/archive/2008/08/30/msdn-low-bandwidth-bookmarklet.aspx" title="Jon Galloway's Blog">post</a> that summarises the benefits of the low bandwidth view. For me, the biggest benefit is the speed of loading, since the page doesn't run lots of JavaScript to sync the contents tree to the currently displayed article.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adrianbanks.co.uk/?feed=rss2&amp;p=61</wfw:commentRss>
		</item>
		<item>
		<title>SQL Server 2005 SP3 Released</title>
		<link>http://www.adrianbanks.co.uk/?p=60</link>
		<comments>http://www.adrianbanks.co.uk/?p=60#comments</comments>
		<pubDate>Tue, 23 Dec 2008 14:31:51 +0000</pubDate>
		<dc:creator>Adrian Banks</dc:creator>
		
		<category><![CDATA[SQL Server 2005]]></category>

		<category><![CDATA[MSDN]]></category>

		<category><![CDATA[kb]]></category>

		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.adrianbanks.co.uk/?p=60</guid>
		<description><![CDATA[Service pack 3 for SQL Server 2005 was released last week. In it, they have fixed a curious bug that I reported back in January.
The bug occurs when trying to delete rows from a table that have a NULL value for an image column. This works fine normally, but if there is a foreign key [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ae7387c3-348c-4faa-8ae5-949fdfbe59c4&#038;displaylang=en" title="SQL Server SP3 Download">Service pack 3</a> for SQL Server 2005 was <a href="http://blogs.msdn.com/sqlreleaseservices/archive/2008/12/16/sql-server-2005-sp3-released.aspx" title="SQL Server Releases">released</a> last week. In it, they have fixed a curious <a href="http://support.microsoft.com/kb/959016/" title="Rows that include a NULL column may not be deleted when you delete rows from a table by using '[ImageColumnName] is NULL' as the condition in the WHERE clause in SQL Server 2005">bug</a> that I reported back in January.</p>
<p>The bug occurs when trying to delete rows from a table that have a NULL value for an image column. This works fine normally, but if there is a foreign key referencing the table (to any of its columns), any rows that have had their image column <strong>updated</strong> to be NULL fail to be deleted. This SQL demonstrates the problem:</p>
<div class="syntax_hilite">
<div id="sql-8">
<span style="color: #808080; font-style: italic;">-- create two linked tables</span><br />
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color:#006600; font-weight:bold;">&#91;</span>dbo<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#006600; font-weight:bold;">&#91;</span>TableA<span style="color:#006600; font-weight:bold;">&#93;</span><br />
<span style="color:#006600; font-weight:bold;">&#40;</span><br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span>Identity<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#91;</span>int<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> IDENTITY<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>,<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span>TableB_Identity<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#91;</span>int<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">NULL</span><br />
<span style="color:#006600; font-weight:bold;">&#41;</span></p>
<p><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color:#006600; font-weight:bold;">&#91;</span>dbo<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span><br />
<span style="color:#006600; font-weight:bold;">&#40;</span><br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span>Identity<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#91;</span>int<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> IDENTITY<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>,<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span> image <span style="color: #993333; font-weight: bold;">NULL</span><br />
<span style="color:#006600; font-weight:bold;">&#41;</span></p>
<p><span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableA<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">ADD</span> CONSTRAINT <span style="color:#006600; font-weight:bold;">&#91;</span>FK_TableA_TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">FOREIGN</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span>TableB_Identity<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">REFERENCES</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span>Identity<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></p>
<p><span style="color: #808080; font-style: italic;">-- insert some data</span><br />
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span><span style="color:#006600; font-weight:bold;">&#41;</span></p>
<p><span style="color: #808080; font-style: italic;">-- this delete works successfully</span><br />
<span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> COUNT<span style="color:#006600; font-weight:bold;">&#40;</span>*<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> Remaining_Count_Should_Be_0 <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span></p>
<p><span style="color: #808080; font-style: italic;">-- insert some data</span><br />
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #993333; font-weight: bold;">NULL</span><span style="color:#006600; font-weight:bold;">&#41;</span></p>
<p><span style="color: #808080; font-style: italic;">-- update the data to be have a NULL value</span><br />
<span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span></p>
<p><span style="color: #808080; font-style: italic;">-- this delete doesn't work</span><br />
<span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> COUNT<span style="color:#006600; font-weight:bold;">&#40;</span>*<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> Remaining_Count_Should_Be_0 <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span></p>
<p><span style="color: #808080; font-style: italic;">-- this delete doesn't work</span><br />
<span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">WHERE</span> ISNULL<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color: #993333; font-weight: bold;">NULL</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> COUNT<span style="color:#006600; font-weight:bold;">&#40;</span>*<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> Remaining_Count_Should_Be_0 <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span></p>
<p><span style="color: #808080; font-style: italic;">-- this delete does work successfully</span><br />
<span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #993333; font-weight: bold;">EXISTS</span><br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">AS</span> TB<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AND</span> TB.<span style="color:#006600; font-weight:bold;">&#91;</span>Identity<span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#006600; font-weight:bold;">&#91;</span>Identity<span style="color:#006600; font-weight:bold;">&#93;</span><br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> COUNT<span style="color:#006600; font-weight:bold;">&#40;</span>*<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> Remaining_Count_Should_Be_0 <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span>
</div>
</div>
<p></p>
<p>Not all of the delete queries work correctly. The output of the script is four result sets with the count of how many rows are in the table at each point. All of them should be 0 (as is the case on SQL Server 2000), but in SQL SERVER 2005 without SP3 they are actually 0, 3, 3 and 0. </p>
<p>The simple delete query:</p>
<div class="syntax_hilite">
<div id="sql-9">
<span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span>
</div>
</div>
<p></p>
<p><strong>does not delete any rows</strong> after the values for the Data column have been updated to NULL, even though a similar select query:</p>
<div class="syntax_hilite">
<div id="sql-10">
<span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span>
</div>
</div>
<p></p>
<p>will return rows.</p>
<p>Notably, if either the foreign key is removed, or the:</p>
<div class="syntax_hilite">
<div id="sql-11">
<span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color:#006600; font-weight:bold;">&#91;</span>TableB<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #993333; font-weight: bold;">DATA</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span>
</div>
</div>
<p></p>
<p>query is not performed, the script behaves as expected. Additionally, using text or ntext instead of image <strong>does not work</strong> as well, but using the new varchar(max), nvarchar(max) or varbinary(max) data types does work.</p>
<p>Apparrently, the distinction between NULL values stored as a result of an insert or an update has precendece in the <strong><a href="http://msdn2.microsoft.com/en-us/library/ms186838.aspx" title="WRITETEXT On SQL Server Books Online">WRITETEXT</a></strong> command:</p>
<div class="quote">If the table does not have in row text, SQL Server saves space by not initializing text columns when explicit or implicit null values are added in text columns with INSERT, and no text pointer can be obtained for such nulls. To initialize text columns to NULL, use the UPDATE statement. If the table has in row text, you do not have to initialize the text column for nulls and you can always get a text pointer.
</div>
<p>This points to the "<strong>text in row</strong>" option having a bearing on this behaviour. Indeed, altering this option after creating the tables:</p>
<div class="syntax_hilite">
<div id="sql-12">
sp_tableoption N<span style="color: #ff0000;">'TableB'</span>, <span style="color: #ff0000;">'text in row'</span>, <span style="color: #ff0000;">'ON'</span>
</div>
</div>
<p></p>
<p>results in the script working as expected. Useful as a potential workaround.</p>
<p>The bug is present in all versions of SQL Server 2005, but not in SQL Server 2000 or 2008.</p>
<p>A full list of what's changed in SP3 can be found <a href="http://msdn.microsoft.com/en-us/library/dd353312(SQL.90).aspx" title="SP3 Details">here</a>, with a full list of the bugs fixed <a href="http://support.microsoft.com/?kbid=955706" title="Bugs Fixed In SP3">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adrianbanks.co.uk/?feed=rss2&amp;p=60</wfw:commentRss>
		</item>
	</channel>
</rss>
