Tag Archive for Codeplex

SQL Server Database Samples for Testing

Whilst trying to get qualified in various sections of IT infrastructure and realising I had some SQL Server knowledge gaps, I started reading the book; Microsoft (Exam 70-432): Microsoft SQL Server 2008 Implementation And Maintenance. A little way into this book, it points you to a website where you can download a variety of Sample/Test SQL Server Databases in different versions and with different features.

Links

http://msftdbprodsamples.codeplex.com/

http://msftdbprodsamples.codeplex.com/releases/view/93587

Information

The 2 databases it recommends for the novice SQL Server user are below. For each release of the product on the webpages above, there is a light-weight and full version of the AdventureWorks sample database. The light-weight version is denoted by the LT abbreviation in the filename.

  1. AdventureWorks2008 Data File.zip
  2. AdventureWorks2008R2 Data File.zip

Each zip file contains an mdf database file and ldf log file.

An AdventureWorks database can be installed by attaching the database, or using the CREATE DATABASE statement.

To attach an AdventureWorks database

  1. Download a database for your SQL Server version.
  2. Unzip the database (mdf) file and log (ldf) file.
  3. From Microsoft SQL Server Management Studio, connect to a SQL Server instance.
  4. Right click Databases.
  5. Click Attach.
  6. Click the Add button.
  7. Locate the AdventureWorks database mdf file. For instance, AdventureWorks2012_Data.mdf.
  8. Click the OK button on the Locate Database Files dialog window.
  9. Click the OK button on the Attach Databases dialog window to attach the database.

CREATE DATABASE statement

From SQL Server Management Studio, execute the following code:

  • Replace {Database Name} with the name of the database. The name of the database is the first part of the mdf file name before the underscore. For example, AdventureWorks2012 in AdventureWorks2012_Data.mdf.
  • Replace {Database File Name} with the name of the database file. For example, AdventureWorks2012_Data.

Example

Thanks

Thanks to the creators of Codeplex who are providing this free and useful service for anyone wanting to test out new and existing technology