Introduction
A problem that you may encounter when trying to install (restore) the AdventureWorks2022 sample database on a SQL Server 2019 instance, is that you recieve an error message like the one in Figure.1.
To overcome this issue, you are going to need to install SQL Server 2022. According to Microsoft, it's the only solution. If you haven't done so already, refer back to the article "Install SQL Server 2022 Developer Edition".
Finding the AdventureWorks2022 sample database
You can get a free copy of the AdventureWorks2022 sample database by clicking on this link.
AdventureWorks2022
You should see the Microsoft sample database download page. Scroll down until you see the section like in Figure.2 and select the link for
"AdventureWorks2022.bak".
Once the download begins, select a folder to save the file to. At this point, it doesn't matter where, just as long as you remember where you saved it.
Do not save this file to your "Downloads" folder. It's best to create a "temp" folder on your drive C: or a second drive in your computer. For this example, I'm saving it to a folder on drive C: called "temp".
Installing (Restoring) the AdventureWorks2022 sample database
This process is pretty easy, but if you know me, you know I'm going to complicate it. (Humor)
Open SQL Server Management Studio (SSMS) and connect to your SQL Server 2022 instance.
In your Object Explorer, right-click on "Databases" and select "Restore Database..." from the drop-down menu.
In the dialouge box that opens, select the "Device" radio button (#1) and click on the elipses (#2).
In the next dialouge box, click the "Add" button.
Navigate to the folder where you saved the AdventureWorks2022.bak file.
As a general rule, you should not save your data files on drive C:. Always save them to another hard drive in your computer. It's also a preferred practice to NOT keep the “mdf” and “ldf” files on the same drive.
If you refer back to Figure.7, you will notice that "pointed out" the "Files" option in the left pane. Click on that and let's change where my data files will be stored.
In the next dialouge box, shown in Figure.8, click on the elipses where the red arrow is in the image.
In the next dialouge box, navigate to the folder where you want to keep your data files.
In my example, I am relocating them to a seperate folder on drive E:
As you can see in the first red box in Figure.9. E:\SQL_All\SQL_2022_Data
In the second red box area, type the name and extension for sample database file. In my sample, I just used the name "AdventureWorks2022.mdf".
Repeat this process for the log files by clicking on the elipses next to the second line as shown in Figure.10 below.
Remember, the log file name should include the word "log" and the extension should be "ldf".
AdventureWorks2022_log.ldf
When you have the folder and file names set, click "OK".
If all went well, you should see the following message.
Okay, I know you're ready to jump right in and start querying data, but there are some additional things you really
need to know before you start querying and modifying data.
The next rational step is to learn RDBMS and Set Theory. Those are explained in the next article found here.
On a side note, if you really want to start playing, go ahead. If you mess up the data, tables, views, etc. you can always drop your sample database and restore it again at any time. Remember, it's just a sample database.