Attach / detatch a database

This article demonstrates how to attach / detatch a database using SQL commands

Open the query analyzer, and enter either

To detatch the database sp_detach_db StuckIndoors

To attach a database sp_attach_single_file_db @dbname = 'StuckIndoors', @physname= 'E:\MSSQLData\data\StuckIndoors.mdf'

 

Share this article!

Follow us!

Find more helpful articles: