--创建数据库
create database student2
on primary
(
name = ‘student2_data‘,
filename = ‘E:\SQlserverWorkspace\student2_data.mdf‘,
size = 5mb,
maxsize = 20mb,
filegrowth = 20%
)
log on
(
name = ‘student2_log‘,
filename = ‘E:\SQlserverWorkspace\student2_log.ldf‘,
size = 5 mb,
maxsize = 10mb,
filegrowth = 2mb
)
go
--创建一个多数据文件和日志文件的数据库
create database students
on primary
(
name = students1,
filename = ‘E:\SQlserverWorkspace\students1_data.mdf‘,
size = 5 mb,
maxsize = unlimited,
filegrowth = 10%
),
(
name = students2,
filename = ‘E:\SQlserverWorkspace\students2_data.mdf‘,
size = 10 mb,
maxsize = 100 mb,
filegrowth = 1
)
log on
(
name = students_log1,
filename = ‘E:\SQlserverWorkspace\students_log1.ldf‘,
size = 5 mb,
maxsize = 50 mb,
filegrowth = 1
),
(
name = students_log2,
filename = ‘E:\SQlserverWorkspace\students_log2.ldf‘,
size = 5 mb,
maxsize = 50 mb,
filegrowth = 1
)
go
//
--修改数据库
--增加数据库的空间
alter database student2
modify file
(
name = student2_data,
size = 20mb
)
--增加数据文件
alter database student2
add file
(
name = ‘student2_data1‘,
filename = ‘E:\SQlserverWorkspace\student2_data1.mdf‘,
size = 5 mb,
maxsize = 10 mb,
filegrowth = 5%
)
--更改数据库的名称
--更改数据库的名称是调用系统的存储过程(sp_renamedb)执行的。
sp_renamedb ‘student2‘,‘studentnew‘
--删除数据库
drop database students
相关文章
- 10-21(二):数据定义语言之数据库操作示例