<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Rob Bamforth&#039;s Blog</title>
	<atom:link href="http://robbamforth.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://robbamforth.wordpress.com</link>
	<description>Java, SQL,T-SQL, MySQL, Networking, SQL Server, PHP, COM, DBA, ODBC</description>
	<lastBuildDate>Thu, 26 Nov 2009 17:20:48 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='robbamforth.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/33c3d538d840082017a4764330c10ea5?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Rob Bamforth&#039;s Blog</title>
		<link>http://robbamforth.wordpress.com</link>
	</image>
			<item>
		<title>SQL – How To get The Current Date Using GetDate()</title>
		<link>http://robbamforth.wordpress.com/2009/11/26/sql-%e2%80%93-how-to-get-the-current-date-using-getdate/</link>
		<comments>http://robbamforth.wordpress.com/2009/11/26/sql-%e2%80%93-how-to-get-the-current-date-using-getdate/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 17:20:48 +0000</pubDate>
		<dc:creator>Rob Bamforth</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[getdate]]></category>
		<category><![CDATA[get date]]></category>

		<guid isPermaLink="false">http://robbamforth.wordpress.com/?p=383</guid>
		<description><![CDATA[The getDate() function is used to generate the current date.
print getDate()
This can be used with variables to create the date format required. The following code will set the string equivalent of the date format DD/MM/YY to the variable @date.
declare @date as nvarchar(50)
declare @day as nvarchar(50)
declare @month as nvarchar(50)
declare @year as nvarchar(50)
declare @zeroday as nvarchar(50)
declare @zeromonth [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=383&subd=robbamforth&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The getDate() function is used to generate the current date.</p>
<blockquote><p>print getDate()</p></blockquote>
<p>This can be used with variables to create the date format required. The following code will set the string equivalent of the date format DD/MM/YY to the variable @date.</p>
<blockquote><p>declare @date as nvarchar(50)<br />
declare @day as nvarchar(50)<br />
declare @month as nvarchar(50)<br />
declare @year as nvarchar(50)<br />
declare @zeroday as nvarchar(50)<br />
declare @zeromonth as nvarchar(50)</p>
<p>&#8211; SET THE DATE<br />
set @date         = cast(getDate() as char)<br />
set @day          = day(@date)<br />
if @day &lt; 10<br />
      set @zeroday = 0<br />
else<br />
      set @zeroday = &#8221;<br />
set @month  = month(@date)<br />
if @month &lt; 10<br />
      set @zeromonth = 0<br />
else<br />
      set @zeromonth = &#8221;<br />
set @year         = year(@date)<br />
set @date   = @zeroday + @day + &#8216;/&#8217; + @zeromonth + @month + &#8216;/&#8217; + right(@year,2)</p>
<p>print @date</p></blockquote>
<p>To get yesterday’s date replace this line</p>
<blockquote><p>set @date         = cast(getDate() as char)</p></blockquote>
<p>with:</p>
<blockquote><p>set @date         = cast(getDate() &#8211; 1 as char)</p></blockquote>
<p>To get the date 1 week ago, use:</p>
<blockquote><p>set @date         = cast(getDate() &#8211; 7  as char)</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robbamforth.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robbamforth.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robbamforth.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robbamforth.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robbamforth.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robbamforth.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robbamforth.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robbamforth.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robbamforth.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robbamforth.wordpress.com/383/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=383&subd=robbamforth&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://robbamforth.wordpress.com/2009/11/26/sql-%e2%80%93-how-to-get-the-current-date-using-getdate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2afb865f358ee9c789b32d0d3c94a891?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rob bamforth</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows Server 2003 &#8211; How to Install IIS on Windows Server 2003</title>
		<link>http://robbamforth.wordpress.com/2009/11/24/windows-server-2003-how-to-install-iis-on-windows-server-2003/</link>
		<comments>http://robbamforth.wordpress.com/2009/11/24/windows-server-2003-how-to-install-iis-on-windows-server-2003/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 16:53:15 +0000</pubDate>
		<dc:creator>Rob Bamforth</dc:creator>
				<category><![CDATA[Windows Server 2003]]></category>
		<category><![CDATA[IIS]]></category>

		<guid isPermaLink="false">http://robbamforth.wordpress.com/?p=380</guid>
		<description><![CDATA[The followig method shows how to install IIS on Windows Server 2003.
You will need the installation source available.
1.Click Start, point to Control Panel, and then click Add or Remove Programs.
2.In Add or Remove Programs, click Add/Remove Windows Components.
3.In the Windows Components Wizard, under Components, select Application Server.
4.Click Next.
5.After the wizard completes the installation, click Finish.
 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=380&subd=robbamforth&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The followig method shows how to install IIS on Windows Server 2003.<br />
You will need the installation source available.</p>
<blockquote><p>1.Click Start, point to Control Panel, and then click Add or Remove Programs.</p></blockquote>
<blockquote><p>2.In Add or Remove Programs, click Add/Remove Windows Components.</p></blockquote>
<blockquote><p>3.In the Windows Components Wizard, under Components, select Application Server.</p></blockquote>
<blockquote><p>4.Click Next.</p></blockquote>
<blockquote><p>5.After the wizard completes the installation, click Finish.</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robbamforth.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robbamforth.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robbamforth.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robbamforth.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robbamforth.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robbamforth.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robbamforth.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robbamforth.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robbamforth.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robbamforth.wordpress.com/380/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=380&subd=robbamforth&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://robbamforth.wordpress.com/2009/11/24/windows-server-2003-how-to-install-iis-on-windows-server-2003/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2afb865f358ee9c789b32d0d3c94a891?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rob bamforth</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL – How To Avoid Divide By Zero Error</title>
		<link>http://robbamforth.wordpress.com/2009/11/23/sql-%e2%80%93-how-to-avoid-divide-by-zero-error/</link>
		<comments>http://robbamforth.wordpress.com/2009/11/23/sql-%e2%80%93-how-to-avoid-divide-by-zero-error/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 11:03:50 +0000</pubDate>
		<dc:creator>Rob Bamforth</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[nulliff]]></category>
		<category><![CDATA[divide by zero]]></category>

		<guid isPermaLink="false">http://robbamforth.wordpress.com/?p=377</guid>
		<description><![CDATA[When you try to divide an integer (or float etc.) by a zero value in SQL it throws a Divide by zero error.
This example illustrates the error:
declare @intA as int
declare @intB as int
set @intA = 50
set @intb = 0
Select @intA / @intB
Message:
Msg 8134, Level 16, State 1, Line 7
Divide by zero error encountered.
The NULLIF statement [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=377&subd=robbamforth&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When you try to divide an integer (or float etc.) by a zero value in SQL it throws a Divide by zero error.</p>
<p>This example illustrates the error:</p>
<blockquote><p>declare @intA as int<br />
declare @intB as int</p>
<p>set @intA = 50<br />
set @intb = 0</p>
<p>Select @intA / @intB</p></blockquote>
<p>Message:</p>
<blockquote><p>Msg 8134, Level 16, State 1, Line 7<br />
Divide by zero error encountered.</p></blockquote>
<p>The NULLIF statement can be used here to avoid the devide by zero error and return a null value instead.</p>
<blockquote><p>declare @intA as int<br />
declare @intB as int</p>
<p>set @intA = 50<br />
set @intb = 0</p>
<p>Select @intA / nullif(@intB, 0)</p></blockquote>
<p>&nbsp;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robbamforth.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robbamforth.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robbamforth.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robbamforth.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robbamforth.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robbamforth.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robbamforth.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robbamforth.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robbamforth.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robbamforth.wordpress.com/377/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=377&subd=robbamforth&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://robbamforth.wordpress.com/2009/11/23/sql-%e2%80%93-how-to-avoid-divide-by-zero-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2afb865f358ee9c789b32d0d3c94a891?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rob bamforth</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL – Cannot resolve the collation conflict between &#8220;SQL_Latin1_General_CP1_CI_AS&#8221; and &#8220;Latin1_General_CI_AS&#8221;</title>
		<link>http://robbamforth.wordpress.com/2009/11/20/sql-%e2%80%93-cannot-resolve-the-collation-conflict-between-sql_latin1_general_cp1_ci_as-and-latin1_general_ci_as/</link>
		<comments>http://robbamforth.wordpress.com/2009/11/20/sql-%e2%80%93-cannot-resolve-the-collation-conflict-between-sql_latin1_general_cp1_ci_as-and-latin1_general_ci_as/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 12:19:45 +0000</pubDate>
		<dc:creator>Rob Bamforth</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[collate]]></category>
		<category><![CDATA[collation]]></category>
		<category><![CDATA[Latin1_General_CI_AS]]></category>
		<category><![CDATA[SQL_Latin1_General_CP1_CI_AS]]></category>

		<guid isPermaLink="false">http://robbamforth.wordpress.com/?p=374</guid>
		<description><![CDATA[This error occurs when trying to join two databases that have different collation.
you can change the collation of a database using the method listed here:
http://robbamforth.wordpress.com/2009/11/13/sql-%e2%80%93-change-the-collation-of-a-database/
If changing the collation of the database isn’t an option then you can force a collation by specifying it in the SLQ statement.
The following code would use the default collation:                    
&#8211;  SELECT
select [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=374&subd=robbamforth&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This error occurs when trying to join two databases that have different collation.</p>
<p>you can change the collation of a database using the method listed here:<br />
<a href="http://robbamforth.wordpress.com/2009/11/13/sql-%e2%80%93-change-the-collation-of-a-database/">http://robbamforth.wordpress.com/2009/11/13/sql-%e2%80%93-change-the-collation-of-a-database/</a></p>
<p>If changing the collation of the database isn’t an option then you can force a collation by specifying it in the SLQ statement.</p>
<p>The following code would use the default collation:                    </p>
<blockquote><p>&#8211;  SELECT<br />
select a.*, b.*<br />
from [DATABASE1] as a<br />
join [DATABASE2] as b<br />
on a.field1 = b.field1 <br />
and a.field2 = b.field2</p></blockquote>
<blockquote><p>&#8211; UPDATE<br />
update [DATABASE1]<br />
set FIELD = B.FIELD<br />
from [DATABASE1] as a<br />
join [DATABASE2] as b<br />
on a.field1 = b.field1 <br />
and a.field2 = b.field2</p></blockquote>
<p>The following will force SQL_Latin1_General_CP1_CI_AI collation:</p>
<blockquote><p>&#8211;  SELECT<br />
select a.*, b.*<br />
from [DATABASE1] as a<br />
join [DATABASE2] as b<br />
on a.field1 = b.field1 COLLATE SQL_Latin1_General_CP1_CI_AI<br />
and a.field2 = b.field2 COLLATE SQL_Latin1_General_CP1_CI_AI</p></blockquote>
<blockquote><p>&#8211; UPDATE<br />
update [DATABASE1]<br />
      set FIELD = B.FIELD<br />
from [DATABASE1] as a<br />
join [DATABASE2] as b<br />
on a.field1 = b.field1 COLLATE SQL_Latin1_General_CP1_CI_AI<br />
and a.field2 = b.field2 COLLATE SQL_Latin1_General_CP1_CI_AI</p></blockquote>
<p>&nbsp;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robbamforth.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robbamforth.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robbamforth.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robbamforth.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robbamforth.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robbamforth.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robbamforth.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robbamforth.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robbamforth.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robbamforth.wordpress.com/374/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=374&subd=robbamforth&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://robbamforth.wordpress.com/2009/11/20/sql-%e2%80%93-cannot-resolve-the-collation-conflict-between-sql_latin1_general_cp1_ci_as-and-latin1_general_ci_as/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2afb865f358ee9c789b32d0d3c94a891?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rob bamforth</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL – How To Check If A String Contains Numbers</title>
		<link>http://robbamforth.wordpress.com/2009/11/19/sql-%e2%80%93-how-to-check-if-a-string-contains-numbers/</link>
		<comments>http://robbamforth.wordpress.com/2009/11/19/sql-%e2%80%93-how-to-check-if-a-string-contains-numbers/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 13:46:49 +0000</pubDate>
		<dc:creator>Rob Bamforth</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[contains interger]]></category>
		<category><![CDATA[patindex]]></category>
		<category><![CDATA[String]]></category>

		<guid isPermaLink="false">http://robbamforth.wordpress.com/?p=370</guid>
		<description><![CDATA[Use the PATINDEX function to check for an integer value continued in the string.
If PATINDEX returns a value greater than 0 then the string does contain an integer, you can use PATINDEX to determine the position of the integer within the string.
If PATINDEX is not greater than zero then the string does not contain an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=370&subd=robbamforth&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Use the PATINDEX function to check for an integer value continued in the string.</p>
<p>If PATINDEX returns a value greater than 0 then the string does contain an integer, you can use PATINDEX to determine the position of the integer within the string.</p>
<p>If PATINDEX is not greater than zero then the string does not contain an integer value.</p>
<blockquote><p>DECLARE @string varchar(50)<br />
SET @string = &#8216;this is a string with numb3rs in it&#8217;</p>
<p>IF PATINDEX(&#8216;%[0-9]%&#8217;,@string) &gt; 0 <br />
      PRINT &#8216;YES, The string has contains the number &#8216; +<br />
                  substring(@string,PATINDEX(&#8216;%[0-9]%&#8217;,@string),1) +<br />
                  &#8216; at position &#8216; +<br />
                  cast(PATINDEX(&#8216;%[0-9]%&#8217;,@string) as char)<br />
ELSE <br />
      PRINT &#8216;NO, The string does not have numbers&#8217;</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robbamforth.wordpress.com/370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robbamforth.wordpress.com/370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robbamforth.wordpress.com/370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robbamforth.wordpress.com/370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robbamforth.wordpress.com/370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robbamforth.wordpress.com/370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robbamforth.wordpress.com/370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robbamforth.wordpress.com/370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robbamforth.wordpress.com/370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robbamforth.wordpress.com/370/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=370&subd=robbamforth&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://robbamforth.wordpress.com/2009/11/19/sql-%e2%80%93-how-to-check-if-a-string-contains-numbers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2afb865f358ee9c789b32d0d3c94a891?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rob bamforth</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL – How to restore a password protected database back up</title>
		<link>http://robbamforth.wordpress.com/2009/11/18/sql-%e2%80%93-how-to-restore-a-password-protected-database-back-up/</link>
		<comments>http://robbamforth.wordpress.com/2009/11/18/sql-%e2%80%93-how-to-restore-a-password-protected-database-back-up/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 11:38:29 +0000</pubDate>
		<dc:creator>Rob Bamforth</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[restore]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[protected]]></category>

		<guid isPermaLink="false">http://robbamforth.wordpress.com/?p=367</guid>
		<description><![CDATA[If you have backed-up a database with password protection such as:
BACKUP DATABASE [DATABASE] TO  DISK = N‘\\NETWORK_STARAGE_LOCATION\database.BAK’ WITH PASSWORD = ‘PASSWORD’,
NOFORMAT, NOINIT,  NAME = N‘DATABASE-Full Database Backup’, SKIP, NOREWIND, NOUNLOAD, STATS=10
GO
As outlined in a previous post http://robbamforth.wordpress.com/2008/11/07/sql-server-2005-database-backup/
Then you will be required to restore the database programmatically as both Enterprise Manger and SQL Server Management Studio [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=367&subd=robbamforth&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you have backed-up a database with password protection such as:</p>
<blockquote><p>BACKUP DATABASE [DATABASE] TO  DISK = N‘\\NETWORK_STARAGE_LOCATION\database.BAK’ WITH PASSWORD = ‘PASSWORD’,<br />
NOFORMAT, NOINIT,  NAME = N‘DATABASE-Full Database Backup’, SKIP, NOREWIND, NOUNLOAD, STATS=10<br />
GO</p></blockquote>
<p>As outlined in a previous post <a href="http://robbamforth.wordpress.com/2008/11/07/sql-server-2005-database-backup/">http://robbamforth.wordpress.com/2008/11/07/sql-server-2005-database-backup/</a></p>
<p>Then you will be required to restore the database programmatically as both Enterprise Manger and SQL Server Management Studio do not support the password option when restoring with the GUI wizard.</p>
<p>To view the files available in the backup:</p>
<blockquote><p><code>RESTORE </code><code>FILELISTONLY </code><code>FROM DISK=</code><code>'</code>\\NETWORK_STARAGE_LOCATION\database.BAK<code>' <br />
</code><code>WITH </code><code>PASSWORD </code><code>= </code><code>'password'</code></p></blockquote>
<p>To run a full simple backup:</p>
<blockquote><p><code>RESTORE DATABASE </code><code>Northwind FROM DISK='</code>\\NETWORK_STARAGE_LOCATION\database.BAK&#8217;<code><br />
</code><code>WITH </code><code>PASSWORD </code><code>= </code><code>'password'</code></p></blockquote>
<p>&nbsp;</p>
<p>This post shows how to restore a backup to a different location to where it was taken: <a href="http://robbamforth.wordpress.com/2009/11/18/sql-%e2%80%93-how-to-restore-a-database-backup-to-a-different-location/">http://robbamforth.wordpress.com/2009/11/18/sql-%e2%80%93-how-to-restore-a-database-backup-to-a-different-location/</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robbamforth.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robbamforth.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robbamforth.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robbamforth.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robbamforth.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robbamforth.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robbamforth.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robbamforth.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robbamforth.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robbamforth.wordpress.com/367/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=367&subd=robbamforth&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://robbamforth.wordpress.com/2009/11/18/sql-%e2%80%93-how-to-restore-a-password-protected-database-back-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2afb865f358ee9c789b32d0d3c94a891?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rob bamforth</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL – How to restore a database backup to a different location</title>
		<link>http://robbamforth.wordpress.com/2009/11/18/sql-%e2%80%93-how-to-restore-a-database-backup-to-a-different-location/</link>
		<comments>http://robbamforth.wordpress.com/2009/11/18/sql-%e2%80%93-how-to-restore-a-database-backup-to-a-different-location/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 11:35:05 +0000</pubDate>
		<dc:creator>Rob Bamforth</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[restore]]></category>

		<guid isPermaLink="false">http://robbamforth.wordpress.com/?p=364</guid>
		<description><![CDATA[You may be required to restore a database backup to a location different from the location of the original backup. If you backed up with a password then this will need to be done programmatically.
The following example shows how to use a backup taken from a database called Database and restore it to a new [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=364&subd=robbamforth&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>You may be required to restore a database backup to a location different from the location of the original backup. If you backed up with a password then this will need to be done programmatically.</p>
<p>The following example shows how to use a backup taken from a database called Database and restore it to a new location on a new server with the name Database2.</p>
<blockquote><p>RESTORE DATABASE [NEW_DATABASE]<br />
FROM  DISK = N&#8217;\\NETWORK_STARAGE_LOCATION\database.BAK&#8217;<br />
WITH  password = &#8216;password&#8217;,<br />
FILE = 1, <br />
MOVE N&#8217;database&#8217; TO N&#8217;C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\database2.mdf&#8217;, <br />
MOVE N&#8217;database_log&#8217; TO N&#8217;C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\database2.log, <br />
NOUNLOAD,  STATS = 10<br />
GO</p></blockquote>
<p>&nbsp;</p>
<p>&nbsp;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robbamforth.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robbamforth.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robbamforth.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robbamforth.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robbamforth.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robbamforth.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robbamforth.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robbamforth.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robbamforth.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robbamforth.wordpress.com/364/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=364&subd=robbamforth&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://robbamforth.wordpress.com/2009/11/18/sql-%e2%80%93-how-to-restore-a-database-backup-to-a-different-location/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2afb865f358ee9c789b32d0d3c94a891?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rob bamforth</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL – What version of SQL 2005 server am I running?</title>
		<link>http://robbamforth.wordpress.com/2009/11/17/sql-%e2%80%93-what-version-of-sql-2005-server-am-i-running/</link>
		<comments>http://robbamforth.wordpress.com/2009/11/17/sql-%e2%80%93-what-version-of-sql-2005-server-am-i-running/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 13:44:59 +0000</pubDate>
		<dc:creator>Rob Bamforth</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[2005]]></category>
		<category><![CDATA[product version]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://robbamforth.wordpress.com/?p=360</guid>
		<description><![CDATA[You can check the version of SQL server running on a machine using the following command in MSQL server management studio:
select @@version
To determine the product version (for example, 9.00.1399.06), the product level (for example, RTM) and the edition (for example, Enterprise Edition) run the following:
SELECT  SERVERPROPERTY(&#8216;productversion&#8217;), SERVERPROPERTY (&#8216;productlevel&#8217;), SERVERPROPERTY (&#8216;edition&#8217;)
      [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=360&subd=robbamforth&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>You can check the version of SQL server running on a machine using the following command in MSQL server management studio:</p>
<blockquote><p>select @@version</p></blockquote>
<p>To determine the product version (for example, 9.00.1399.06), the product level (for example, RTM) and the edition (for example, Enterprise Edition) run the following:</p>
<blockquote><p>SELECT  SERVERPROPERTY(&#8216;productversion&#8217;), SERVERPROPERTY (&#8216;productlevel&#8217;), SERVERPROPERTY (&#8216;edition&#8217;)</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robbamforth.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robbamforth.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robbamforth.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robbamforth.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robbamforth.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robbamforth.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robbamforth.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robbamforth.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robbamforth.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robbamforth.wordpress.com/360/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=360&subd=robbamforth&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://robbamforth.wordpress.com/2009/11/17/sql-%e2%80%93-what-version-of-sql-2005-server-am-i-running/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2afb865f358ee9c789b32d0d3c94a891?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rob bamforth</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL &#8211; How To Shrink Un-shrinkable Database Log / Database Log Won&#8217;t Shrink</title>
		<link>http://robbamforth.wordpress.com/2009/11/16/sql-how-to-shrink-un-shrinkable-database-log-database-log-wont-shrink/</link>
		<comments>http://robbamforth.wordpress.com/2009/11/16/sql-how-to-shrink-un-shrinkable-database-log-database-log-wont-shrink/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 10:34:14 +0000</pubDate>
		<dc:creator>Rob Bamforth</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[Shrink]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[tsql]]></category>

		<guid isPermaLink="false">http://robbamforth.wordpress.com/?p=348</guid>
		<description><![CDATA[The following should only be considered as a last resort to force the log file to shrink. I suggest you take a full database back-up first.
The DBCC LOGINFO can be run against the database. This will give you information about your virtual logs inside your transaction log.
In particular look at the Status column. Status = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=348&subd=robbamforth&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The following should only be considered as a last resort to force the log file to shrink. I suggest you take a full database back-up first.</p>
<p>The DBCC LOGINFO can be run against the database. This will give you information about your virtual logs inside your transaction log.<br />
In particular look at the Status column. Status = 2 indicates the portions of the log that are in use, status = 0 are not in use.</p>
<blockquote><p>DBCC LOGINFO (DATABASE_NAME)</p></blockquote>
<p>Step 1:<br />
Attemp to shrink the problematic log file and back up the database with TRUNCATE_ONLY.</p>
<blockquote><p>USE [DATABASE_NAME]<br />
GO<br />
DBCC SHRINKFILE (N&#8217;DATABASE_NAME&#8217; , 0, TRUNCATEONLY)<br />
GO</p>
<p>BACKUP LOG [DATABASE_NAME]<br />
WITH TRUNCATE_ONLY</p></blockquote>
<p>Step 2:<br />
Create a temporary table and insert a record.</p>
<blockquote><p>CREATE TABLE MyTable (MyField VARCHAR(10), PK INT )<br />
INSERT Mytable (PK) VALUES (1)<br />
GO</p></blockquote>
<p>Step 3:<br />
Run the following loop to update the table.</p>
<blockquote><p>SET NOCOUNT ON<br />
DECLARE @Index INT<br />
SELECT @Index = 0<br />
WHILE (@Index &lt; 20000)<br />
BEGIN<br />
   UPDATE MyTable SET MyField = MyField WHERE PK = 1<br />
   SELECT @Index = @Index + 1<br />
END<br />
SET NOCOUNT OFF</p></blockquote>
<p>The log rows with status 2 should now be available with statis = 0.</p>
<p>Step 4:<br />
Re-run the shrink command.</p>
<blockquote><p>USE [DATABASE_NAME]<br />
GO<br />
DBCC SHRINKFILE (N&#8217;DATABASE_NAME&#8217; , 0, TRUNCATEONLY)<br />
GO</p>
<p>BACKUP LOG [DATABASE_NAME]<br />
WITH TRUNCATE_ONLY</p>
<p>&#8211; Drop the temporary table as no longer required<br />
drop table MyTable</p></blockquote>
<p>The log file should now have shrunk successfully.</p>
<p>Source: http://www.broad-lea.com/sql_server/sql_reduce_log_size.html</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robbamforth.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robbamforth.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robbamforth.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robbamforth.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robbamforth.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robbamforth.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robbamforth.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robbamforth.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robbamforth.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robbamforth.wordpress.com/348/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=348&subd=robbamforth&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://robbamforth.wordpress.com/2009/11/16/sql-how-to-shrink-un-shrinkable-database-log-database-log-wont-shrink/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2afb865f358ee9c789b32d0d3c94a891?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rob bamforth</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL &#8211;  Server blocked access to procedure &#8217;sys.sp_OACreate&#8217;</title>
		<link>http://robbamforth.wordpress.com/2009/11/13/sql-server-blocked-access-to-procedure-sys-sp_oacreate/</link>
		<comments>http://robbamforth.wordpress.com/2009/11/13/sql-server-blocked-access-to-procedure-sys-sp_oacreate/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 15:59:34 +0000</pubDate>
		<dc:creator>Rob Bamforth</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Ole Automation Procedures]]></category>
		<category><![CDATA[sp_OACreate]]></category>
		<category><![CDATA[SQL Server 2005]]></category>

		<guid isPermaLink="false">http://robbamforth.wordpress.com/?p=342</guid>
		<description><![CDATA[&#160;
A user logged in with administrator privileges can enable the use of &#8216;Ole Automation Procedures&#8217; b with sp_configure .
Advanced options need to be set before running sp_configure.
sp_configure &#8217;show advanced options&#8217;, 1;
GO
RECONFIGURE;
GO
sp_configure &#8216;Ole Automation Procedures&#8217;, 1;
GO
RECONFIGURE;
GO
You should see the following output:
Configuration option &#8217;show advanced options&#8217; changed from 0 to 1. Run the RECONFIGURE statement to install.
Configuration [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=342&subd=robbamforth&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&nbsp;</p>
<p>A user logged in with administrator privileges can enable the use of &#8216;Ole Automation Procedures&#8217; b with sp_configure .<br />
Advanced options need to be set before running sp_configure.</p>
<blockquote><p>sp_configure &#8217;show advanced options&#8217;, 1;<br />
GO<br />
RECONFIGURE;<br />
GO<br />
sp_configure &#8216;Ole Automation Procedures&#8217;, 1;<br />
GO<br />
RECONFIGURE;<br />
GO</p></blockquote>
<p>You should see the following output:</p>
<blockquote><p>Configuration option &#8217;show advanced options&#8217; changed from 0 to 1. Run the RECONFIGURE statement to install.<br />
Configuration option &#8216;Ole Automation Procedures&#8217; changed from 0 to 1. Run the RECONFIGURE statement to install</p></blockquote>
<p>Alternatively this can be done in SQL server 2005 Surface Area Configuration through the menu options :</p>
<blockquote><p>surface area configuration for features -&gt; OLE Automation -&gt; Enable OLE automation</p></blockquote>
<p>You will now be able to re-run the previously blocked procedure with success.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robbamforth.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robbamforth.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robbamforth.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robbamforth.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robbamforth.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robbamforth.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robbamforth.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robbamforth.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robbamforth.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robbamforth.wordpress.com/342/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robbamforth.wordpress.com&blog=4820827&post=342&subd=robbamforth&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://robbamforth.wordpress.com/2009/11/13/sql-server-blocked-access-to-procedure-sys-sp_oacreate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2afb865f358ee9c789b32d0d3c94a891?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rob bamforth</media:title>
		</media:content>
	</item>
	</channel>
</rss>