Skip to main content

How to Rename SQL DB even when it is in USE ?

 

Use this script to rename your db.

This one sets single user mod first so that there is exclusive access, then rename the db and bring back to normal mode (multi_user mode)

 

USE master;
GO

ALTER DATABASE [Old_DB_Name]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO

ALTER DATABASE [Old_DB_Name]
MODIFY NAME=
[New_DB_Name]
GO

ALTER DATABASE [New_DB_Name]
SET MULTI_USER WITH ROLLBACK IMMEDIATE
GO

Comments

Popular posts from this blog

How to accept outlook meeting invite via keyboard shortcut ?

  There are two ways you can accept a meeting request. 1. when you are browsing list mail (and invite isn't opened) 2. wen you have opened the invite

Tips 'n' Tricks : SVN : Visual Studio Plugin : AnkhSvn

Now we can access SVN from Visual Studio :) ,

HTC Wildfire Gets Android 2.2 Froyo update

Yes, Thats correct HTC has quietly (brilliantly) shipped the long pending Android 2.2 - Froyo update for the HTC Wildfire . I have updated my HTC to Android 2.2. I am gonna share my experience which one should read before starting the upgrade. Statistics Pre-Requisite Process / Steps What you get? (features of Android 2.2 Froyo) What you loose?