Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Problem With AdventureWorks Expand / Collapse
Author
Message
Posted Monday, December 3, 2012 2:50 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 3:06 PM
Points: 33,169, Visits: 15,304
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
Post #1392156
Posted Tuesday, December 25, 2012 7:37 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, September 13, 2013 8:55 PM
Points: 18, Visits: 68
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.
Post #1400125
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse