How SQL Server 2012 deletes a database

Source: Internet
Author: User
Tags management studio microsoft sql server management studio sql server management sql server management studio

Statement: I now in Jiangsu Province Taicang a company to work, the content of this blog is only representative of my views, not on behalf of the company, only

Only some technology sharing, if there is conflict with the company's privacy technology, I will dispose of, but also thank the company to give me the opportunity, industry

Yu on the Internet to write some technical articles, I will cherish the current job opportunities, and strive to repay the company, the return of their families.

Microsoft SQL Server Management studio--> Object Explorer--database

Two methods:

1. Right-click Delete

2.drop Database dbname


The following error occurred while deleting "cannot delete * * database, the database is currently in use"

ALTER DATABASE dbname set offline with rollback immediate

or select Disconnect

After you do this, the operation is deleted normally.


650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/83/29/wKiom1dr4JCxdTWVAAEfUl7YOdQ712.jpg-wh_500x0-wm_3 -wmp_4-s_2056837101.jpg "title=" 2016-06-22_092054.jpg "style=" Float:none; "alt=" Wkiom1dr4jcxdtwvaaeful7yodq712.jpg-wh_50 "/>


For example, click OK can be deleted, if the execution error, you can select the Figure 2, Close existing connecting.



650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/83/28/wKioL1dr4I6gSmSaAAIWU470Wu0872.jpg-wh_500x0-wm_3 -wmp_4-s_3679250279.jpg "style=" Float:none; "title=" 2016-06-22_091959.jpg "alt=" Wkiol1dr4i6gsmsaaaiwu470wu0872.jpg-wh_50 "/>


You can also click Script to view the delete T-SQL that deleted the database.



650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/83/28/wKioL1dr4JCiFMMEAAFOqVwzo4M299.jpg-wh_500x0-wm_3 -wmp_4-s_2393227069.jpg "style=" Float:none; "title=" 2016-06-22_092103.jpg "alt=" Wkiol1dr4jcifmmeaafoqvwzo4m299.jpg-wh_50 "/>


You can see the script.


650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/83/28/wKioL1dr4JLQ_57xAAM2c3bhYkc922.jpg-wh_500x0-wm_3 -wmp_4-s_1809662311.jpg "style=" Float:none; "title=" 2016-06-22_092131.jpg "alt=" wkiol1dr4jlq_ 57xaam2c3bhykc922.jpg-wh_50 "/>



This article is from "Hangzhou Technology blog" blog, please be sure to keep this source http://hangyc.blog.51cto.com/427521/1792351

How SQL Server 2012 deletes a database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.