Monday, August 19, 2013

Rename a Database

 Aug19th2013

 To Rename any user  Database you could follow the steps and to run the below querey you will require alter permissions on the database 


USE [master];
GO
ALTER DATABASE  OLDDATABASE  SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO
EXEC sp_renamedb N'OLDDATABASE  ', N'NEWDATABASE ';
GO
ALTER DATABASE NEWDATABASE SET MULTI_USER


Back up the master database after you rename any database.

https://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context...