Monday, July 16, 2012

Need a Sample databases to analyze the new feature in SQL server 2012 - Adventureworks

Are you eager to learn about how to work with SQL server database engine? For you, Microsoft SQL server offers several samples & sample databases to analyze the working functionality of SQL server database engine. There are several samples & sample databases are available.

Here is the list of Samples:
  1. Programmability Sample: Demonstrates the use of SQL server management objects
  2. XML Sample: demonstartes the use of use of XML
  3. Administration Sample: Demonstartes the use of administrative features
  4. Data Access Sample: Demonstrates the use of SQL server
  5. Full-text Search Sample: Helps in how to use full-text search
  6. Query Processing sample: Helps in how to use query processing

Here is the list of sample databases that help in analyzing of SQL server database engine:

  1. Pubs Sample Databases: It was used in SQL server 2000.
  2. Northwind sample databases: It is the best sample databases for SQL server 2000.
  3. Adventurework Sample databases: It is newly introduced sample databases for SQL server 2005 and replaced above two sample databases from SQL server 2005.

For security purpose, Microsoft does not include any of the samples or sample databases with SQL server. To learn about SQL server storage engine, you have to locate and download samples & sample databases. All the samples & sample databases are available at Microsoft SQL server community project.

Note: If you want to install the samples then the default location of samples files is C:\Program Files\Microsoft SQL Server\100\Samples\.

SQL server 2012 is the latest version of SQL server, if you want to test some new features in SQL server 2012 then download Adventureworks sample databases from here. After the successful download of adventureworks, you will have to attach the adventureworks sample databases.

You have two option to attach adventureworks sample databases:
  1. Attach Adventureworks using SQL server management studio
  2. Attach Adventureworks using T-SQL
Attach Adventureworks using SQL server management studio: To do this, you have to follow bellow steps:
  • Right click on the databases
  • Select Attach and click Add
  • Now select the adventureworks mdf file
  • If got any error message for log file then simpally select & remove log file(ldf)
  • Click Ok
Attach Adventureworks using T-SQL: If you want to attach a database with the transaction log file then you have to select attach_rebuild_log option. Attach_rebuild_log option automatically creates 1 MB transaction log file and placed this file in the default log file location.

The command would be:

CREATE DATABASE SampledatabasesAdventureWorks_Data
ON (FILENAME = N'E:\SQLData\sampledatabasesAdventureWorks_Data.mdf')

How to Verify the Integrity of Adventureworks sample Databases?
You can verify logical & physical integrity of adventureworks sample databases by runing this query

DBCC CHECKDB ('SampledatabasesAdventureWorks_Data')

No comments:

Post a Comment