Hi Friends
What command do we use to rename a db ?
Rename a db in SQL
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pradip PandeyRank #452 · 5.6K reputationPosted Sep 26, 2012, 3:12 AM EDT
Check this link
http://msdn.microsoft.com/en-us/library/aa238879(v=sql.80).aspx
http://www.mssqltips.com/sqlservertip/1122/how-to-rename-a-sql-server-database/
Hope it will help.
nallyaRank #8,588 · 219 reputationPosted Sep 26, 2012, 3:15 AM EDT
1) issues these commands
ALTER DATABASE yourdatabase MODIFY FILE (NAME = logical_file_name, FILENAME = 'your-new-file-on-disk.mdf' )2) detach the database
3) rename the files on disk
4) re-attach the database again
Use this
http://www.sourcecodester.com/tutorials/3759/how-rename-sql-server-database-and-database-filename-mdf-file.html
http://dbalink.wordpress.com/2008/07/10/how-to-rename-sql-server-2005-database-using-tsql/
Satyapriya NayakRank #47 · 31.5K reputationPosted Sep 26, 2012, 3:18 AM EDT
Chetan Kumar31 reputationPosted Oct 22, 2012, 3:52 AM EDT
Sp_renamedb 'olddbname','newdbname'