- 4
- 0
- 约7.84千字
- 约 9页
- 2020-06-08 发布于安徽
- 举报
创建数据库的一般步骤:
(一)、切换系统数据库
use master
go
(二)、判断数据库是否已有的同名数据库并将其删除
(1) 、if exists (select * from sys.sysdatabases where [name]= 数据库名称 )
drop database 数据库名称
go
(2) 、if (select count(*) from sys.sysdatabases where [name]=数据库名称 ) 0
drop database 数据库名称
go
注: sys.sysdatabases :指的是一个系统视图
(3) 、if db_id( 数据库名称 ) is not null
drop database 数据库名称
注意: db_id : 是 SQL Server 中的一个系统函数,用于返回数据库标识 (id) 号
db_id 函数的使用语法:
db_id ([ 数据库名称 ]) 若省略数据库名称则返回当前数据库的 id,若查询不到,则返回 null
(三)、创建文件夹的两种方法:
(1)、 启用外围配置【此方法适用于找不到“
原创力文档

文档评论(0)