If you searched for how to install adventureworks db, the most likely intent is simple: you want Microsoft’s sample database running in SQL Server so you can practice queries, test code, follow tutorials, or demo something without building a database from scratch. Microsoft provides three main flavors: AdventureWorks for OLTP, AdventureWorksDW for data warehousing, and AdventureWorksLT as a lighter version; if you are unsure, Microsoft explicitly recommends starting with the OLTP version that matches your SQL Server version.[learn.microsoft]
The shortest path for most people is restoring the correct .bak file into SQL Server through SQL Server Management Studio, because it is faster and less fussy than building the whole database from scripts. Microsoft also supports script-based installation, and those scripts create the sample database with the compatibility of your current SQL Server version, which is useful when you want a fresh build rather than a restore.github+1
What to download first
Before you install anything, decide which AdventureWorks edition you actually need. AdventureWorks is the transactional sample database, AdventureWorksDW is the warehouse version, and AdventureWorksLT is a slimmed-down sample that Microsoft uses in lighter scenarios such as Azure SQL demonstrations.learn.microsoft+1
Here is the practical version:
| Sample | Best for | Notes |
|---|---|---|
| AdventureWorks (OLTP) | SQL practice, joins, stored procedures, training labs | Best default choice for most people. [learn.microsoft] |
| AdventureWorksDW | BI, reporting, star-schema learning | Better if you are learning warehousing concepts. github+1 |
| AdventureWorksLT | Lightweight demos, Azure SQL sample data | Smaller and simpler, but less complete. [learn.microsoft] |
Microsoft’s current documentation lists versioned backup files such as AdventureWorks2025.bak, AdventureWorks2022.bak, AdventureWorks2019.bak, and older equivalents, plus matching DW and LT files. Microsoft also notes that AdventureWorks has not changed much since the 2012 version; the main differences across versions are the database name and compatibility level.github+1
That last detail matters more than people expect. If you are installing AdventureWorks for a tutorial that specifically references AdventureWorks2019, use that version if possible, because a lot of confusion comes from people having the “right” database with the “wrong” name. SQL is usually forgiving; tutorial screenshots are not.github+1
Prerequisites that actually matter
To install AdventureWorks locally, Microsoft says you need SQL Server plus either SQL Server Management Studio or the MSSQL extension for Visual Studio Code. If you are using the script-based method rather than a backup restore, the GitHub README also lists FILESTREAM as a prerequisite on the SQL Server instance.github+1
That gives you a sensible checklist:
- SQL Server installed and running.[learn.microsoft]
- SSMS installed, unless you prefer a T-SQL tool or VS Code with the MSSQL extension.[learn.microsoft]
- The right
.bakfile or install script package downloaded from Microsoft’s official sample sources.github+1 - FILESTREAM enabled if you plan to use the install scripts.[github]
If you’re not sure what you need, start with the OLTP version that matches your SQL Server version.[learn.microsoft]
That is the safest default because it lines up with the most common search intent behind how to install adventureworks db: getting a practical sample database working quickly for SQL learning or development.[learn.microsoft]
Fastest method: restore the .bak file in SSMS
For most readers, this is the method to use. Microsoft’s official guidance says you can restore AdventureWorks by downloading the appropriate .bak file, moving it into the SQL Server backup location, and then restoring it through SSMS.[learn.microsoft]
Step 1: Download the correct backup
Go to Microsoft’s AdventureWorks sample database page or GitHub release and download the version that fits your SQL Server instance. You can generally restore a version-specific backup to its matching SQL Server version or a later version, but the restored database keeps the compatibility level of the version it came from.github+1
A simple rule works well here:
- SQL Server 2022: start with
AdventureWorks2022.bakor the newest listed backup your environment supports.[learn.microsoft] - SQL Server 2019: use
AdventureWorks2019.bak.[learn.microsoft] - SQL Server 2017: use
AdventureWorks2017.bak.[learn.microsoft]
Step 2: Move the file to the backup folder
Microsoft says the backup location varies by install path, instance name, and SQL Server version. For example, the default backup path for a default SQL Server 2022 instance is C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Backup.[learn.microsoft]
Older examples in Microsoft’s GitHub README show similar folder patterns for earlier versions, such as MSSQL13.MSSQLSERVER\MSSQL\Backup for SQL Server 2016. The naming changes, but the idea stays the same: put the .bak where SQL Server expects backup files to live, or at least somewhere the SQL Server service account can access.[github]
Step 3: Restore the database in SSMS
Microsoft’s restore process in SSMS is straightforward:
- Open SSMS and connect to your SQL Server instance.[learn.microsoft]
- In Object Explorer, right-click Databases and choose Restore Database…[learn.microsoft]
- Select Device, then click the ellipsis button.[learn.microsoft]
- Choose Add and select the
.bakfile.[learn.microsoft] - Check the Files tab so the “Restore as” paths look correct.[learn.microsoft]
- Click OK to restore the database.[learn.microsoft]
If the backup file does not appear in the picker, Microsoft says the usual reason is permissions: either SQL Server or the signed-in SQL user does not have access to that file or folder. That is one of those annoyances that feels mysterious for about seven minutes and then turns out to be very ordinary.[learn.microsoft]
Step 4: Confirm it worked
After restore, refresh the Databases node in SSMS and look for the new database name, such as AdventureWorks2022. Open a new query window and run a simple test query like SELECT TOP 10 * FROM Person.Person; if you restored the OLTP sample, just to confirm the tables exist and the database is usable. The table example is a practical validation step based on the known OLTP schema purpose, while the restore success itself is confirmed by Microsoft’s documented process.github+1
Alternative method: install AdventureWorks from scripts
The script-based route is useful when you want the database generated to match your current SQL Server version’s compatibility settings. According to Microsoft’s GitHub README, the install scripts can be used on any version of SQL Server, including CTPs, service packs, and interim releases, and each script generates version-specific information based on your current instance.[github]
How the script install works
Microsoft’s instructions for the OLTP sample are plain enough:
- Copy the AdventureWorks data files and scripts into
C:\Samples\AdventureWorks, or download theAdventureWorks-oltp-install-script.zipand extract it there.[github] - Open
C:\Samples\AdventureWorks\instawdb.sqlin SSMS.[github] - Follow the instructions at the top of the script.[github]
For the warehouse sample, the equivalent file is instawdbdw.sql in C:\Samples\AdventureWorksDW.[github]
Important script install gotcha
This one is easy to miss and worth calling out because it behaves like a trap designed by a mildly mischievous coworker. Microsoft states that the OLTP script drops an existing AdventureWorks database, and the DW script drops an existing AdventureWorksDW database; if you do not want that, edit $(DatabaseName) in the script and use a different name such as AdventureWorks-new.[github]
That means if you already have a working copy and casually rerun the script, SQL Server may helpfully “clean up” your existing sample database right before you had any intention of losing it. Charming. Efficient. Slightly rude.[github]
When scripts are better than restore
Use the script method when:
- You need the database generated with the compatibility of your current SQL Server version.[github]
- You want more control over the database name during creation.[github]
- You are working through an environment where scripted setup is easier to repeat than manual restore.[github]
For everyone else, restoring the .bak is usually quicker. That is not a formal law of physics, but it does feel close.github+1
T-SQL restore example
If you prefer queries over dialogs, Microsoft provides T-SQL restore examples. Their current Microsoft Learn page shows a Windows example for AdventureWorks2025 and a Linux example using /var/opt/mssql/backup and /var/opt/mssql/data paths.[learn.microsoft]
A basic Windows pattern looks like this:
sqlUSE [master];
GO
RESTORE DATABASE [AdventureWorks2025]
FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Backup\AdventureWorks2025.bak'
WITH
FILE = 1,
NOUNLOAD,
STATS = 5;
GO
That example comes directly from Microsoft’s documented restore pattern, but the exact database name and file path depend on your environment. Microsoft also shows that Linux restores typically need explicit MOVE clauses for the data and log files.[learn.microsoft]
If you are restoring an older sample or a DW version, swap in the right database name and path. Microsoft’s GitHub README also includes an example using MOVE clauses for AdventureWorksDW2016, which is helpful when SQL Server needs explicit destination file names.[github]
Common problems and how to fix them
Most failures when people look up how to install adventureworks db are not dramatic. They are usually one of a few familiar SQL Server issues wearing different hats.github+1
“I can’t see the .bak file in SSMS”
Microsoft says this usually means SQL Server or the SQL user does not have permission to that folder or file. Move the backup into the SQL Server backup directory recommended for your instance, or verify the service account can read the location.[learn.microsoft]
“The database name doesn’t match my tutorial”
That is normal. Microsoft publishes version-specific names like AdventureWorks2019 and AdventureWorks2022, and the script method defaults to generic names such as AdventureWorks unless you edit the script.github+1
If a course says USE AdventureWorks2019 and your database is just AdventureWorks, either rename it or adjust the tutorial queries. SQL will not be offended. Tutorial copy-paste blocks sometimes will.learn.microsoft+1
“Restore failed because the file path is wrong”
Microsoft explicitly warns that example file paths use default locations and might need to be updated to match your environment. This applies to both SSMS file placement and T-SQL restore commands.github+1
“Should I use AdventureWorks or AdventureWorksLT?”
For most local practice, use the full OLTP sample first. Microsoft says LT is a lightweight pared-down version, which is useful, but it is not the same experience as the full sample database most SQL Server tutorials assume.[learn.microsoft]
“Do I need FILESTREAM?”
Only for the script-based installation, according to the GitHub README prerequisites. If you are restoring from a backup, Microsoft’s main restore guidance does not list FILESTREAM as a general prerequisite in the same way.github+1
Which install option makes sense for your setup
Different environments call for different methods, and this is where a little realism beats a one-size-fits-all tutorial.learn.microsoft+1
Local Windows machine
Use SSMS and restore the .bak file. Microsoft documents this cleanly, and it is the least complicated route for most developers, analysts, and students.[learn.microsoft]
SQL Server on Linux
Use the .bak restore with Linux paths such as /var/opt/mssql/backup and /var/opt/mssql/data, plus MOVE clauses where needed. Microsoft provides a Linux-specific restore example for that exact scenario.[learn.microsoft]
Azure SQL Database
Microsoft does not have you restore the regular .bak file straight into a standard Azure SQL Database the same way you would on-box. Instead, for a new Azure SQL Database, Microsoft’s documented sample route is creating a database and selecting Sample data, which loads AdventureWorksLT.[learn.microsoft]
Microsoft Fabric SQL database
Microsoft’s Fabric documentation says to create a new SQL database and choose Sample data, which loads AdventureWorksLT there as well. That is not the full local restore workflow, but it is the officially documented sample-data path for Fabric.learn.microsoft+1
FAQ
Frequently asked questions
What is the easiest way to install AdventureWorks DB?
For most users, the easiest method is restoring the official .bak file through SSMS. Microsoft documents that flow directly and supports versioned backups for multiple SQL Server releases.[learn.microsoft]
Which AdventureWorks version should I download?
Microsoft recommends starting with the OLTP version that matches your SQL Server version if you are unsure. That is the safest answer for tutorials, practice, and general development work.[learn.microsoft]
Can I restore an older AdventureWorks backup to a newer SQL Server?
Yes. Microsoft states that version-specific backups can be restored to their respective SQL Server version or a later version, though the restored database keeps the compatibility level of the source version.[github]
Is AdventureWorks still current?
Current enough for learning and demos, yes; cutting-edge as a modern schema example, not really. Microsoft’s GitHub README says AdventureWorks has not seen significant changes since 2012 and points to WideWorldImporters as a sample that uses more recent SQL Server features.[github]
Should I use AdventureWorks or AdventureWorksDW?
Use AdventureWorks for transaction-style practice such as joins, CRUD-style examples, stored procedures, and general SQL training. Use AdventureWorksDW if your goal is warehouse modeling, analytical queries, or BI-style practice.github+1
Can I create AdventureWorks from scripts instead of restoring a backup?
Yes. Microsoft provides install scripts for both the OLTP and DW versions, and those scripts create the database using the compatibility of your current SQL Server version. Just remember that the default scripts can drop an existing database with the same name unless you change $(DatabaseName).[github]
Final takeaway
If your goal is simply to learn how to install adventureworks db, restore the official .bak file in SSMS and use the OLTP version that matches your SQL Server release. That is the cleanest route, the most widely supported one in Microsoft’s documentation, and the option least likely to turn a five-minute setup job into an accidental archaeology dig through file paths, compatibility levels, and mysteriously invisible backup files.github+1

Leave a Reply