<?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>Server Side Guy &#187; SQL Server</title>
	<atom:link href="http://serversideguy.com/category/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://serversideguy.com</link>
	<description>Just another Barsness Solutions weblog</description>
	<lastBuildDate>Wed, 04 Apr 2012 21:37:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>SQL Server Error 3154</title>
		<link>http://serversideguy.com/2009/07/16/sql-server-error-3154/</link>
		<comments>http://serversideguy.com/2009/07/16/sql-server-error-3154/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 21:13:59 +0000</pubDate>
		<dc:creator>Tim Barsness</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[T-SQL]]></category>

		<guid isPermaLink="false">http://serversideguy.com/?p=47</guid>
		<description><![CDATA[I ran accross the SQL Server error 3154. In SQL Server 2008, it says &#8220;Restore Failed for Server &#8216;ServerName\InstanceName&#8217;&#8221; Additional Information: &#8220;System.Data.SQLClient.SqlError: The backup set holds a backup of a database other than the existing &#8216;dbname&#8217; database. (Microsoft.SqlServer.Smo)&#8221; Solution: Use WITH REPLACE.  This can be found in the GUI tool or done in T-SQL as [...]]]></description>
			<content:encoded><![CDATA[<p>I ran accross the SQL Server error 3154.  In SQL Server 2008, it says &#8220;Restore Failed for Server &#8216;ServerName\InstanceName&#8217;&#8221; Additional Information:  &#8220;System.Data.SQLClient.SqlError: The backup set holds a backup of a database other than the existing &#8216;dbname&#8217; database.  (Microsoft.SqlServer.Smo)&#8221;</p>
<h2>Solution:</h2>
<p>Use WITH REPLACE.  This can be found in the GUI tool or done in T-SQL as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">RESTORE</span> <span style="color: #0000FF;">DATABASE</span> dbname
<span style="color: #0000FF;">FROM</span> <span style="color: #0000FF;">DISK</span> <span style="color: #808080;">=</span> <span style="color: #FF0000;">'C:<span style="color: #000099; font-weight: bold;">\d</span>bname.bak'</span>
<span style="color: #0000FF;">WITH</span> <span style="color: #FF00FF;">REPLACE</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://serversideguy.com/2009/07/16/sql-server-error-3154/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Escaping Single Quotes in MS SQL Server (T-SQL)</title>
		<link>http://serversideguy.com/2009/06/02/escaping-single-quotes-in-ms-sql-server-t-sql/</link>
		<comments>http://serversideguy.com/2009/06/02/escaping-single-quotes-in-ms-sql-server-t-sql/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 15:33:27 +0000</pubDate>
		<dc:creator>Tim Barsness</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://serversideguy.com/?p=16</guid>
		<description><![CDATA[Escaping single quotes (&#8216;) in Transact-SQL is done by replacing the single quote with two single quotes. So: SELECT 'I went to Kinko''s' Returns &#8220;I went to Kinko&#8217;s&#8221; The only case where two consecutive single quotes don&#8217;t return a single quote is when the first one also starts the string.  In this case, if only [...]]]></description>
			<content:encoded><![CDATA[<p>Escaping single quotes (&#8216;) in Transact-SQL is done by replacing the single quote with two single quotes.  So:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">SELECT <span style="color: #0000ff;">'I went to Kinko'</span><span style="color: #0000ff;">'s'</span></pre></div></div>

<p>Returns &#8220;I went to Kinko&#8217;s&#8221;</p>
<p>The only case where two consecutive single quotes don&#8217;t return a single quote is when the first one also starts the string.  In this case, if only two single quotes are present, the second one ends the string and the return value is the empty string.  <a href="http://sqlblogcasts.com/blogs/madhivanan/archive/2008/02/19/understanding-single-quotes.aspx" target="_blank">SQL Blog Casts</a> has a good example of this.</p>
<h2>Doing the same in MySQL</h2>
<p>Escaping a single quote in MySQL is done by adding a backslash before it (\&#8217;)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">SELECT <span style="color: #0000ff;">'I went to Kinko\'s'</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://serversideguy.com/2009/06/02/escaping-single-quotes-in-ms-sql-server-t-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

