SQL Server sample databases

Here are some places on the web where you can find sample databases for SQL Server. It’s nice to have some of them on your local instance.

1. The AdventureWorks sample databases for SQL Server versions can be found on the following link http://msftdbprodsamples.codeplex.com/. There are the backup files to download so a simple restore from them makes the databases available on your instance.

2. Get a sample database of Stack overflow via a torrent that you can find here – https://archive.org/details/stackexchange. For this database, you’ll need a torrent client in order to download it. Then you’ll have to unzip the file and attach it in your instance.

3. Northwind and Pubs are older sample databases that can be found on this link https://technet.microsoft.com/en-us/library/ms143221(v=sql.105).aspx

Download and install the file from the above link so that you have the files in a folder .. SQL Server 2000 Sample Databases.

If you go with the ATTACH method you’ll be given the following error message:

Msg 1813, Level 16, State 2, Line 3
Could not open new database ‘Northwind’. CREATE DATABASE is aborted.
Msg 950, Level 20, State 1, Line 3
Database ‘Northwind’ cannot be upgraded because its non-release version (539) is not supported by this version of SQL Server.
You cannot open a database that is incompatible with this version of sqlservr.exe. You must re-create the database.

The message itself tells you that the database is incompatible with your version of SQL server.

Get the .SQL files in your editor and before executing find stored procedure (SP) sp_dboption. That SP is not existing and you just have to comment it and run the Execute button to create the databases.

4. You can take some of the Paul Randal’s example databases here as well.

(Update on 21.06.2016)

5. WideWorldImportes is one of the newest databases on internet. You can find it here https://github.com/Microsoft/sql-server-samples/releases/tag/wide-world-importers-v0.1

It’s a sample database for SQL Azure as well.

6. The following project “Create a Sample SQL Database in Less Than 2 Minutes” on Code Project is also a simple database that could be used – https://www.codeproject.com/Tips/326527/Create-a-Sample-SQL-Database-in-Less-Than-Minute

There are for sure other sample databases on the internet, so in case you know some, just share them in the comments.

Tweet about this on TwitterShare on LinkedInShare on FacebookShare on Google+

Leave a Reply

Your email address will not be published. Required fields are marked *