<?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>Dushyanth Jyothi &#187; AdvenureWorks</title>
	<atom:link href="http://dushi.co.uk/tag/advenureworks/feed/" rel="self" type="application/rss+xml" />
	<link>http://dushi.co.uk</link>
	<description>Me, My Life and the Binary</description>
	<lastBuildDate>Thu, 22 Jul 2010 21:14:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>An error occurred when attaching the database</title>
		<link>http://dushi.co.uk/14/07/2009/an-error-occurred-when-attaching-the-database/</link>
		<comments>http://dushi.co.uk/14/07/2009/an-error-occurred-when-attaching-the-database/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 21:56:01 +0000</pubDate>
		<dc:creator>Dushyanth Jyothi</dc:creator>
				<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[AdvenureWorks]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[MS SQL Server 2008]]></category>

		<guid isPermaLink="false">http://dushi.co.uk/?p=66</guid>
		<description><![CDATA[An error occurred when attaching the database &#8211; AdvenureWorks databaseThe below steps applies to MS SQL Server 2008A. Make sure you enabled database instance to use FILESTREAM as instructed here:http://msdn.microsoft.com/en-us/library/cc645923.aspxB. If you downloaded Adventureworks from codeplex, make sure you have set the right user permissions to these filesC. Copy AdventureWorks2008_Data.mdf and AdventureWorks2008_Log.ldf to&#8216;C:\Program Files\Microsoft SQL [...]]]></description>
			<content:encoded><![CDATA[<strong>An error occurred when attaching the database &#8211; AdvenureWorks database</strong><br /><br />The below steps applies to MS SQL Server 2008<br /><br />A. Make sure you enabled database instance to use <strong>FILESTREAM </strong>as instructed here:<br /><a href="http://msdn.microsoft.com/en-us/library/cc645923.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/cc645923.aspx</a><br /><br />B. If you downloaded Adventureworks from codeplex, make sure you have set the right <strong>user permissions</strong> to these files<br /><br />C. <strong>Copy </strong>AdventureWorks2008_Data.mdf and AdventureWorks2008_Log.ldf to<br />&#8216;C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\&#8217;<br />If you see a folder called &#8216;Documents&#8217; in the downloaded files set, then copy this folder also to &#8216;C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\&#8217;<br /><br />D. In the managment studio, open new query window and <strong>execute the below code</strong>: [Change the files path accordingly]<br /><br /><pre class="devcodeblock" title="T-SQL"><table class="devcodetools"><tbody><tr><td>&nbsp;T-SQL&nbsp;|&nbsp;</td><td style="background-image:url('http://dushi.co.uk/wp-content/plugins/devformatter/img/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;"/><embed id="ZeroClipboard2" src="http://dushi.co.uk/wp-content/plugins/devformatter/_zclipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="16px" height="16px" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=2&width=16&height=16" wmode="transparent" /></td><td>&nbsp;copy&nbsp;code&nbsp;|</td><td style="cursor:pointer" title="DevFormatter Plugin" onclick="devfmt_credits()">?</td><td width="99%">&nbsp;</td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tr><td class="devcodelines" width="1%">1</td><td class="devcodelinesarea"><pre class="devcode devcodeline"><span style="color: #0000FF;">USE</span> <span style="color: #808080;">&#91;</span>master<span style="color: #808080;">&#93;</span></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">2</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">GO</pre></td></tr><tr><td class="devcodelines" width="1%">3</td><td class="devcodelinesarea"><pre class="devcode devcodeline"><span style="color: #0000FF;">CREATE</span> <span style="color: #0000FF;">DATABASE</span> <span style="color: #808080;">&#91;</span>Adventureworks<span style="color: #808080;">&#93;</span> <span style="color: #0000FF;">ON</span></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">4</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"><span style="color: #808080;">&#40;</span> FILENAME <span style="color: #808080;">=</span> N<span style="color: #FF0000;">'C:<span style="color: #000099; font-weight: bold;">\P</span>rogram Files<span style="color: #000099; font-weight: bold;">\M</span>icrosoft SQL Server<span style="color: #000099; font-weight: bold;">\M</span>SSQL10.MSSQLSERVER<span style="color: #000099; font-weight: bold;">\M</span>SSQL<span style="color: #000099; font-weight: bold;">\D</span>ATA<span style="color: #000099; font-weight: bold;">\A</span>dventureWorks2008_Data.mdf'</span> <span style="color: #808080;">&#41;</span>,</pre></td></tr><tr><td class="devcodelines" width="1%">5</td><td class="devcodelinesarea"><pre class="devcode devcodeline"><span style="color: #808080;">&#40;</span> FILENAME <span style="color: #808080;">=</span> N<span style="color: #FF0000;">'C:<span style="color: #000099; font-weight: bold;">\P</span>rogram Files<span style="color: #000099; font-weight: bold;">\M</span>icrosoft SQL Server<span style="color: #000099; font-weight: bold;">\M</span>SSQL10.MSSQLSERVER<span style="color: #000099; font-weight: bold;">\M</span>SSQL<span style="color: #000099; font-weight: bold;">\D</span>ATA<span style="color: #000099; font-weight: bold;">\A</span>dventureWorks2008_Log.ldf'</span> <span style="color: #808080;">&#41;</span></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">6</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"><span style="color: #0000FF;">FOR</span> ATTACH</pre></td></tr><tr><td class="devcodelines" width="1%">7</td><td class="devcodelinesarea"><pre class="devcode devcodeline">GO</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">8</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"><span style="color: #0000FF;">IF</span> not exists <span style="color: #808080;">&#40;</span><span style="color: #0000FF;">SELECT</span> name <span style="color: #0000FF;">FROM</span> master.<span style="color: #202020;">sys</span>.<span style="color: #202020;">databases</span> sd <span style="color: #0000FF;">WHERE</span> name <span style="color: #808080;">=</span> N<span style="color: #FF0000;">'Adventureworks'</span> and <span style="color: #FF00FF;">SUSER_SNAME</span><span style="color: #808080;">&#40;</span>sd.<span style="color: #202020;">owner_sid</span><span style="color: #808080;">&#41;</span> <span style="color: #808080;">=</span> <span style="color: #FF00FF;">SUSER_SNAME</span><span style="color: #808080;">&#40;</span><span style="color: #808080;">&#41;</span> <span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">EXEC</span> <span style="color: #808080;">&#91;</span>Adventureworks<span style="color: #808080;">&#93;</span>.<span style="color: #202020;">dbo</span>.<span style="color: #AF0000;">SP_CHANGEDBOWNER</span> @loginame<span style="color: #808080;">=</span>N<span style="color: #FF0000;">'sa'</span>, @<span style="color: #0000FF;">MAP</span><span style="color: #808080;">=</span><span style="color: #0000FF;">FALSE</span></pre></td></tr><tr><td class="devcodelines" width="1%">9</td><td class="devcodelinesarea"><pre class="devcode devcodeline">GO</pre></td></tr></table></div></pre>
<br /><strong>OR  you can attach a databse either using MS:</strong><br />1. In SQL Server Management Studio Object Explorer, connect to an instance of the Microsoft SQL Server Database Engine, and then expand that instance.<br />2. Right click Databases, then Tasks, and then click Attach.<br />3. In the Attach Databases dialog box, to specify the database to be attached, click Add; and in the Locate Database Files dialog box, select the disk drive where the database resides and expand the directory tree to find and select the .mdf file of the database; for example: C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\AdventureWorks2008_Data.mdf<br /><br />Optionall : Specify a different name, Change the ownership<br />4. When you are ready to attach the database, click OK.]]></content:encoded>
			<wfw:commentRss>http://dushi.co.uk/14/07/2009/an-error-occurred-when-attaching-the-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
