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

Learning Angular With Baljeet : Day 01

I would be posting a series on learning angular js

I would be posting small todos, if you follow along you should be able t

To Beging with

1. you need to install Node.JS (https://nodejs.org/en/)
2. Node.js would get you npm also
3. Download WebStorm as Editor
4. Download Angular CLI command npm install -g @angular/cli)
5. Create new angular app (command d:\RnD\Angular\> ng new HelloAngular
7. open your newly created project in browser by command ng serve --open

one pending todo here is overview of the angular project basic terminolgies
app --> module --> component
every component would have --> .ts , .css, .htmls , .spec file

- Baljeetsingh

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

Now we can access SVN from Visual Studio :) ,