Skip to content

Detach Database

How to Detach a Database in SQL Server Management Studio?

· User can Detach a Database in the SQL server that will remove the Database from the list of Databases.

· Open SQL Server Management Studio --> File --> Connect Object Explorer.

Create New Database.

· To detach any Database, let's create a new database to illustrate the process.

· Right-click on Databases and click on New Database.

img

Enter the Database name as NewDatabase and click Add.

img

· The new database will create and appear under Databases.

img

Detach Database

· Right-click on the Database that has to be Detached. Go to Tasks and select Detach.

img

· There are two checkboxes in the new tab.

  1. Drop Connections – The server will drop all the connections with the Database selected.

  2. Update Statistics – It will update the statistics once the Database is detached.

· Click Ok once when the changes are made.

image

· NewDatabase will be detached from the Databases.

img