Search⌘ K

Attaching AdventureWorks database

Explore the process of attaching and detaching the AdventureWorks database to a SQL Server instance using SSMS and T-SQL commands. Learn to download, extract, and link database files, manage log files, and use system stored procedures to control database states for hands-on SQL practice.

Attaching database to server instance

Let’s learn to attach the “AdventureWorks” database to an SQL Server instance. It can help in practicing T-SQL syntax.

Click here to download the “AdventureWorks” database, and then click the arrow in the top-right corner to download the file. After it finishes downloading, extract the zip file to a location on the computer. It’s best to save it with the rest of the database files.

Now go back to SSMS and into the “Object Explorer” window. Find the “Databases” tree, right-click it, and click “Attach.”

Next, click the "Add" button to locate the “.MDF” file we downloaded for the ...