Part 2 Creating, altering and dropping a database
A SQL Server database can be created, altered and dropped
1. Graphically using SQL Server Management Studio (SSMS) or
2. Using a Query
To create the database graphically
1. Right Click on Databases folder in the Object explorer
2. Select New Database
3. In the New Database dialog box, enter the Database name and click OK.
To Create the database using a query
Create database DatabaseName
Whether, you create a database graphically using the designer or, using a query, the following 2 files gets generated.
.MDF file - Data File (Contains actual data)
.LDF file - Transaction Log file (Used to recover the database)
To alter a database, once it's created
Alter database DatabaseName Modify Name = NewDatabaseName
Alternatively, you can also use system stored procedure
Execute sp_renameDB 'OldDatabaseName','NewDatabaseName'
To Delete or Drop a database
Drop Database DatabaseThatYouWantToDrop
Dropping a database, deletes the LDF and MDF files.
You cannot drop a database, if it is currently in use. You get an error stating - Cannot drop database "NewDatabaseName" because it is currently in use. So, if other users are connected, you need to put the database in single user mode and then drop the database.
Alter Database DatabaseName Set SINGLE_USER With Rollback Immediate
With Rollback Immediate option, will rollback all incomplete transactions and closes the connection to the database.
Part 2 Creating, altering and dropping a database的更多相关文章
- [Hive - Tutorial] Creating, Showing, Altering, and Dropping Tables
Creating, Showing, Altering, and Dropping Tables See Hive Data Definition Language for detailed info ...
- [Django] Creating an app, models and database
To add a new app, first cd to the project. Then run: python manage.py startapp scrumboard After that ...
- ora-00600笔记
一. ORA-600 概述 Errorsof the form ORA-600 are called internal errors. This section clarifies themisund ...
- kudu 介绍
kudu的好处: 快速的olap 列式存储,Hadoop parquet 的一种替代方案 对数据的顺序处理和随机处理都很高效 * High availability. Tablet Servers a ...
- oracle-Expdp/impdp命令
建立逻辑路径 create or replace directory dumpdir as 'c:\'; grant read,write on directory dumpdir to scott; ...
- 关于SQL Server系统数据库详解
介绍这里我们介绍SQL Sever内部的系统数据库的作用和用户数据库之间联系,关于SQL Sever如何管理用户数据库的原理,对于每个数据库开发人员和DBA都是必须掌握的. SQL Sever系统数据 ...
- P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1
P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1 May ...
- [转]Creating an Entity Framework Data Model for an ASP.NET MVC Application (1 of 10)
本文转自:http://www.asp.net/mvc/overview/older-versions/getting-started-with-ef-5-using-mvc-4/creating-a ...
- 【原】Configuring Oracle Data Guard In Physical Standby Database
作者:david_zhang@sh [转载时请以超链接形式标明文章] http://www.cnblogs.com/david-zhang-index/p/5042640.html参照文档:https ...
随机推荐
- 深入理解JavaScript-replace
replace方法是属于String对象的,可用于替换字符串. 简单介绍: StringObject.replace(searchValue,replaceValue) StringObject:字符 ...
- java面试笔试试题http://www.jobui.com/mianshiti/it/java/6827/
一.判断题(每题1分,共10分)1.Applet是一种特殊的Panel,它是Java Applet程序的最外层容器.()2.Java的源代码中定义几个类,编译结果就生成几个以.class为后缀的字节码 ...
- Android 中View的绘制机制源代码分析 三
到眼下为止,measure过程已经解说完了,今天開始我们就来学习layout过程.只是在学习layout过程之前.大家有没有发现我换了编辑器,哈哈.最终下定决心从Html编辑器切换为markdown编 ...
- Android简单封装类似JQuery异步请求
在android开发中经常会使用异步请求数据,通常会使用handler或者AsyncTask去做,handler 配合message 使用起来比较麻烦,AsyncTask 线程池只允许128个线程工作 ...
- python代码查询港澳通行证办理进度
查询港澳通行证办理进度查询的python 3.3代码.利用socket请求相关网站,获得结果后利用正则找出办理进度.其实用urllib代码会更简洁,不过当时在下还不熟悉urllib~ 直接上代码: i ...
- Debian的定时执行命令Crontab
转载:http://i.592.net/?post=276 Debian的定时执行命令Crontab,这个相当于Windows的计划任务 想要让Debian定时执行命令就得靠crontab了! ...
- Maven项目报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
刚刚新建完Maven项目,一般都会报这个错误,原因是没有默认添加需要的javax.servelet的jar包,所以打开pom.xml文件添加如下dependency即可: <dependency ...
- FITS 基本格式及其扩展
一.FITS 一般介绍二.FITS 的一般结构三.FITS 基本格式四.FITS 的随机组扩展五.FITS 的表扩展 (ASCII 表扩展)六.FITS 的一般扩展和块因子参考文献 FITS 基本格式 ...
- Wcf 之 配置文件解析
在WCF Service Configuration Editor的使用中,我们通过配置工具自动生成了WCF服务端的config文件.现在我们来看下这个配置文件各个标签的意义(解释在下面xml文件中的 ...
- JavaScript中数组操作
var arr1=new Array(); arr1.push(1);//在数组的中末尾添加元素,并返回新的长度 arr1.push(2);//在数组的中末尾添加元素,并返回新的长度 arr1.pop ...