(二):数据定义语言之数据库操作示例
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
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。