Replace a Database in SSMS – SQL Instructions
Target Audience: Basic User, Advanced User, IT Manager
Article #: 13165
Summary
There may come a time when you need to replace a database in Microsoft SQL Server Management Studio (SSMS). Follow the instructions in this article to replace an older version with an updated database.
Preparation
Create a backup of the database that will be replaced.
Instructions
- Log into SSMS and navigate to the old database.
- Get the path to this database:
a. Right click on its Properties.
b. Go to Files.
c. Copy the path from Files and save the location for later use.

- Right-click on the old database again and select Tasks -> Detach.

- Check the Drop Connections box and hit OK.

- Place the new database and database log file into the same location (path) as the old file, using the path you saved in Step 2.

- Locate the new database file in SSMS and right-click on it and then click Attach.

- In the menu that opens up, click Add. This will bring up the list of databases within the path from Step 2.
- Click on the new database in the Locate Database Files window and then click OK.

- Once the Locate Database Files window closes, the Attach Databases window will show the details for the .mdf and .log files. Click OK to complete database’s addition.

- To confirm success, open the newly added database and confirm that it contains the correct data.

Additional Comments
Tested with SQL Express 2019 running on Windows 11.
If you need further assistance, please contact us.
Author
Related Articles
- Replace a Database in SSMS – SQL Instructions
- Setting Up BreadCrumbs Server with SQL 2022 – Sigo Instructions
- Create ODBC OLE Data Source for CODESOFT – Instructions
- Create a View from an External Table with a Record ID in TEKLYNX CENTRAL – Instructions
- Configuring the External Database Feature – TEKLYNX CENTRAL Instructions
- Backup a SQL Database to a File – SQL Server Instruction Article