This topic describes how to attach a database. You can also use this feature to copy, move, or upgrade a SQL Server database.
1. Connect to a server instance.
2. Open the Attach Database dialog by doing one of the following:
3. In the Browse Files dialog, choose the .mdf
file of the required database, then click OK.
Warning
Trying to select a database that is already attached results in an error.
4. Optional: To add multiple .mdf
files:
4.1. In the Attach Database dialog, click Add.
4.2. In the Browse Files dialog, choose the .mdf
file, then click OK.
4.3. Repeat these steps for each file you want to add.
5. Optional: To set a different name for the database, double-click its name in Attach As and specify a new name.
Tip
To remove the selected file from the grid in the Attach Database dialog, click Remove.
6. To apply the changes, click OK.
The database gets the icon, indicating that the database has been attached.
7. To close the dialog, click Close.
Watch this video to learn how to detach and attach a database in SQL Server.