Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase ««12

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



Group: Administrators
Last Login: Yesterday @ 3:36 PM
Points: 34,362, Visits: 18,572
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
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Sunday, February 14, 2016 8:11 AM
Points: 50, 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.
Post #1400125
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse