patternsqlMinor
Remove Database from SQL Management Studio Database List
Viewed 0 times
sqlremovedatabasestudiomanagementlistfrom
Problem
I'm working with MS SQL Express 2008 and Visual Studio 2010.
If you are attached to a local
Trying to simply delete the the database of course deletes the files as well. I tried unchecking the
Odd thing is when I search I don't see simlar questions. I'd think that would be something others would want to do.
Right now I make a copy of the
Is there a better way?
If you are attached to a local
MDF file how do you remove it from the Databases list without deleting the file? The reason is to purge the list of databases for old projects. The next time you run the project it will re-establish the connection so it makes sense to make things tidy and easy to find when you need it.Trying to simply delete the the database of course deletes the files as well. I tried unchecking the
Delete backup and restore history information for databases but that didn't make a difference. I also tried the ole' Shift-Delete to alter its functionality.Odd thing is when I search I don't see simlar questions. I'd think that would be something others would want to do.
Right now I make a copy of the
MDF and LDF files, delete the database from Management Studio and then copy the file back.Is there a better way?
Solution
- Right click the database in SSMS
- Click Tasks
- Click Detach
To attach the database:
- Right click the databases node
- Select Attach
- Add the MDF file. The LDF file will be added automatically if it's in the same folder
Context
StackExchange Database Administrators Q#20538, answer score: 3
Revisions (0)
No revisions yet.