Companion content for Microsoft® SQL Server® 2012 Step by Step

  1. Click the following link:

    Download the companion content.

  2. The File Download dialog box opens.
  3. Click Save.
  4. The Save As dialog box opens.
  5. Choose Desktop.
  6. Click Save.
  7. Locate the .zip file on your desktop. Right-click the file, click Extract All, and then follow the instructions.

  8. Download the sample database(s)

    For each database:

    1. Click the following link:

      Download the sample database(s)

    2. The File Download dialog box opens.
    3. Click Save.
    4. The Save As dialog box opens.
    5. Choose a location where you want to store this sample database (.mdf file).

    Note You can save the .mdf file wherever you like, but one good place is to save it in the default SQL Server databases folder. You need administrator permission to do that. Typically, the local databases folder is C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA.

    Attach the sample database(s)

    1. Start SQL Server Management Studio (SSMS).
    2. Connect to your SQL Server 2012 instance.
    3. For each database:

    4. In Object Explorer, right-click the Databases node beneath your SQL Server 2012 instance and then choose Attach.
    5. Beneath Databases To Attach, click Add.
    6. In the Local Database Files dialog, scroll to the downloaded .mdf file that you saved locally, select it, and then click OK.
    7. IMPORTANT When using this method to attach, SSMS will by default also search for the .ldf file (which isn't included), causing the attach-process to fail. You must manually remove the .ldf before clicking OK as discussed in the next step.

    8. Beneath the database details list, select the Log file (filename ending with .ldf) and then click Remove.
    9. Click OK.

    You can find more instructions related to attaching databases here: This should be an FW link pointing to:

    Support issues

    Companion content hosted for Microsoft Press by O'Reilly Media, distributor of Microsoft Press books. If you need assistance, please contact or O'Reilly Customer Service.


    For more information about this book, including a complete list of errata, click here.

    Take our survey

    Your feedback will help us make our books as informative, insightful, and useful as they can be. Click here to take the survey.