Problem With AdventureWorks

  • Hello:

    I am new to this forum and would like some help with SQL Server 2008 R2 Express. I downloaded SQL with no problems, but I'm having problems loading the sample databases so SQL Server can recognize it.

    Thank you for your help!

  • What did you try? Did you try to attach it, restore it?

  • I downloaded the AdventureWorksR2 data file on my C-Drive Folder. Then I opened my SQL Server Express and opened a new query. From there I could not navigate to the database on my C-Drive.

  • did you ever attach the database? does it show up under the Databases folder in SSMS?

  • I don't know how to attach the database.

  • Did you unzip the database file(s)? There should be two - one is an MDF file (database file) and the other is the LDF.

    Open SSMS.

    Right-click on Databases

    choose Attach Database...

    You should be prompted for the location of the MDF and LDF files. If they're in the same directory, it's super easy.

  • I think I'm almost there. One problem though. When I right click to attach the database and select the files I get this error message. "An error occurred when attaching the database(s). Click the hyperlink in the Message column for details". I'm not sure where the message column is. I only see the hyperlink to the view connection properties.

  • I found the error msg. It says "Unable to open the physical file "C:\SSQL\AdventureWorksR2_Data.mdf". Operating System error 5: "5(Access is denied.)" (Microsoft SQL Server, Error: 5120).:(

  • Without an error message, I'm afraid I can't help you. :w00t: Can't diagnose what I can't see! Do it again and see if you can get an error message. Are you trying to use the 2012 version of AdventureWorks by accident? That would make 2008 throw a fit, I'm sure. If necessary, go to CodePlex and make sure you have downloaded the correct version.

  • Does the account that SQL was setup as have permissions to the location where you put the MDF file?

    Joie Andrew
    "Since 1982"

  • 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.

  • 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.

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply