Saturday, 19 April 2014

Detach and Attach in SQL SERVER

Detach and Attach

Step 1: Attach and Detach database
Before proceeding need to know what is attach and detach!
While we took backup of a database, the .bak file saved in drive and also exists in server
when ever use a detach option this will takes backup of database and drops the database from server
While attach like a restore of a database which already backedup.

The following are the steps how we can attach and detach the database
Step 2: Click on database -->Tasks-->Detach
If you found following error, Set your database to Single User mode using SET operator
Now choose drop connections then click OK

Also the following is the SP also how to set database into single user mode
Attach:
Click on database-->Attach
Choose database which you want to restore
click ok
The database came to previous position

No comments:

Post a Comment

EMP, DEPT Sample script

/****** Object:  Table [dbo].[DEPT]    Script Date: 19-05-2016 06:58:37 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET A...