SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Problem With AdventureWorks


Problem With AdventureWorks

Author
Message
Steve Jones
Steve Jones
SSC Guru
SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)

Group: Administrators
Points: 61785 Visits: 19099
The AdventureWorks files aren't files like Word or Excel. These are databases. You cannot browse them. They need to be attached to the SQL Server instance in order for it to perform queries on them.

sp_attach_db or using the GUI (right click the Databases folder) you can attach the files. However it's not your account, it's the service account that runs SQL Server that does this.

The best way to do this is to copy the .mdf and .ldf files to the \Data folder under SQL Server. This is usually under C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA or something similar.

Then run the attach.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
VegasL
VegasL
SSC Journeyman
SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)

Group: General Forum Members
Points: 94 Visits: 159
Hi Pirrot,

Excellent Question. I had exact same problem and recieved same error message. I spent about 3 hrs researching to finding the right resource to find the fix.

What you need to do before you ATTACH this db, is run in query window:

create database adventureworks2012
on (filename = 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\AdventureWorksDW2012_Data.mdf')
for attach_rebuild_log ;


if you're using any other version of adventureworks just rename the file. Also notice, the path of the filename, you may need to edit it to fit you're specfic path.


After you have run this query then you shouldn't get this error when attaching.


Hope this helps.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search