求使用sql语句创建和删除数据库的代码

求使用sql语句创建和删除数据库的代码,第1张

数据库文件

create database mydb

on primary

( name = mydb_data1,

filename = 'd:\sql data\mydb_data1.mdf',

size = 1,

maxsize = unlimited,

filegrowth = 10% ),

filegroup data2

( name = mydb_data2,

filename = 'd:\sql data\mydb_data2.ndf',

size = 2,

maxsize = 100,

filegrowth = 1 ),

filegroup data3

( name = mydb_data3,

filename = 'd:\sql data\mydb_data3.ndf',

size = 3,

maxsize = 50,

filegrowth = 500kb )

log on

( name = 'mydb_log1',

filename = 'd:\sql data\mydb_log1.ldf',

size = 1mb,

maxsize = 25mb,

filegrowth = 10% ),

( name = 'mydb_log2',

filename = 'd:\sql data\mydb_log2.ldf',

size = 1mb,

maxsize = 10mb,

filegrowth = 10% ),

( name = 'mydb_log3',

filename = 'd:\sql data\mydb_log3.ldf',

size = 1mb,

maxsize = 5mb,

filegrowth = 512kb )

createdatabase数据库名称

on

(

name='aaa',

filename='aaa.dbf',

size=初始大小,

maxsize=存储上限,

filegrowth=增长增量

)

logon

(

name='b',

filename='b.ldf',

size=初始大小,

maxsize=存储上限,

filegrowth=增长增量

)

扩展资料:

SQL语句创建基本数据库

SQL语句代码:CREATEDATABASE语句。

CREATEDATABASEEpiphany

ON

(

NAME=Epiphany,

FILENAME='E:\SQLSERVER2008\Epiphany_data.mdf',

SIZE=5MB,

MAXSIZE=20,

FILEGROWTH=20

)

LOGON

(

NAME=Epiphany,

FILENAME='E:\SQLSERVER2008\Epiphany_log.ldf',

SIZE=2MB,

MAXSIZE=10MB,

FILEGROWTH=1MB

)

可以用这个模板,例子:

CREATEDATABASEEpiphany

ON

(

NAME=Epiphany,

FILENAME='E:\SQLSERVER2008\Epiphany_data.mdf',

SIZE=5MB,

MAXSIZE=20,

FILEGROWTH=20

)

LOGON

(

NAME=Epiphany,

FILENAME='E:\SQLSERVER2008\Epiphany_log.ldf',

SIZE=2MB,

MAXSIZE=10MB,

FILEGROWTH=1MB

)

完毕!


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/9984902.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-04
下一篇 2023-05-04

发表评论

登录后才能评论

评论列表(0条)

保存