Answered by:
Delete a datbase named delete

Question
-
A co-worker created and then restored a 6.5 compatible database and named it delete in SQL 2005. We are running windows 7 and have SQL 2000 on our XP virtual machines so the database can not be renamed and then deleted. Does anyone know if this database can be removed?Tuesday, February 2, 2010 12:57 AM
Answers
-
Sorry for not getting your question completely.
If you want to rename a database and delete a database created with the KEYWORD ( you can use the square brackets ) , use the following TSQL
sp_renamedb 'test','delete'
go
drop database [delete]
-- If this not what you wanted , can you add more clarity to your question.
Thanks, Leks- Proposed as answer by Naomi N Tuesday, February 2, 2010 2:59 AM
- Marked as answer by Arnie RowlandMVP Tuesday, February 2, 2010 5:56 PM
Tuesday, February 2, 2010 1:26 AMAnswerer -
To Delete database use command:
drop database [delete]
go
To rename database to Test use below command:-
sp_renamedb 'delete','test'
go
I hope this will clarify your question.
Cheers
Vishal- Marked as answer by theflyingtaz Tuesday, February 2, 2010 5:31 PM
Tuesday, February 2, 2010 3:40 PM
All replies
-
Sorry for not getting your question completely.
If you want to rename a database and delete a database created with the KEYWORD ( you can use the square brackets ) , use the following TSQL
sp_renamedb 'test','delete'
go
drop database [delete]
-- If this not what you wanted , can you add more clarity to your question.
Thanks, Leks- Proposed as answer by Naomi N Tuesday, February 2, 2010 2:59 AM
- Marked as answer by Arnie RowlandMVP Tuesday, February 2, 2010 5:56 PM
Tuesday, February 2, 2010 1:26 AMAnswerer -
Sorry for not getting your question completely.
If you want to rename a database and delete a database created with the KEYWORD ( you can use the square brackets ) , use the following TSQL
sp_renamedb 'test','delete'
go
drop database [delete]
-- If this not what you wanted , can you add more clarity to your question.
Thanks, LeksTuesday, February 2, 2010 9:32 AM -
Hello Rajpes,
As per my code , i have changed the database name from test to delete.
Now you tell me which database is present in the SQL server ?
Remember that sp_renamedb syntax is sp_renamedb 'olddbname' , 'newdbname' and not vice versa..
Thanks, LeksTuesday, February 2, 2010 9:44 AMAnswerer -
Hello Rajpes,
As per my code , i have changed the database name from test to delete.
Now you tell me which database is present in the SQL server ?
Remember that sp_renamedb syntax is sp_renamedb 'olddbname' , 'newdbname' and not vice versa..
Thanks, Leks
but he did not say that old db name is test .Tuesday, February 2, 2010 12:14 PM -
I Have just used that as a sample code .
Thanks, LeksTuesday, February 2, 2010 3:32 PMAnswerer -
To Delete database use command:
drop database [delete]
go
To rename database to Test use below command:-
sp_renamedb 'delete','test'
go
I hope this will clarify your question.
Cheers
Vishal- Marked as answer by theflyingtaz Tuesday, February 2, 2010 5:31 PM
Tuesday, February 2, 2010 3:40 PM -
Thanks that worked.Tuesday, February 2, 2010 5:32 PM