mssql server CREATE DATABASE创建数据库代码
/*
if db_id('test') is not null drop database test
go
create database test
on primary (
name=test_dat_main1
,filename='d:databasetest_dat_main1.mdf'
,size=3mb
,maxsize=unlimited
,filegrowth=5mb
),(
name=test_dat_main2
,filename='d:databasetest_dat_main2.mdf'
,size=3mb
,maxsize=unlimited
,filegrowth=5mb
)
,filegroup test_dat_sub1 default (
name=test_dat_sub1
,filename='d:databasetest_dat_sub1.mdf'
,size=2mb
,maxsize=unlimited
,filegrowth=5mb
),(
name=test_dat_sub2
,filename='d:databasetest_dat_sub2.mdf'
,size=2mb
,maxsize=unlimited
,filegrowth=5mb
)
,filegroup test_dat_sub2 (
name=test_dat_sub3
,filename='d:databasetest_dat_sub3.mdf'
,size=2mb
,maxsize=unlimited
,filegrowth=5mb
)
log on (
name=test_log1
,filename='d:databasetest_log1.ldf'
,size=10mb
,maxsize=unlimited
,filegrowth=10mb
),(
name=test_log2
,filename='d:databasetest_log2.ldf'
,size=10mb
,maxsize=unlimited
,filegrowth=10mb
)
collate chinese_prc_ci_as
with
db_chaining off
,trustworthy off
语法
create database database_name
[ on
{ [ primary ] [
[ ,
[ log on {
]
[ collate collation_name ]
[ with
]
[;]
to attach a database
create database database_name
on
for { attach [ with
| attach_rebuild_log }
[;]
{
(
name = logical_file_name ,
filename = { 'os_file_name' | 'filestream_path' }
[ , size = size [ kb | mb | gb | tb ] ]
[ , maxsize = { max_size [ kb | mb | gb | tb ] | unlimited } ]
[ , filegrowth = growth_increment [ kb | mb | gb | tb | % ] ]
) [ ,...n ]
}
{
filegroup filegroup_name [ contains filestream ] [ default ]
}
{
[ db_chaining { on | off } ]
[ , trustworthy { on | off } ]
}
{
enable_broker
| new_broker
| error_broker_conversations
}
create a database snahot
create database database_snapshot_name
on
(
name = logical_file_name,
filename = 'os_file_name'
) [ ,...n ]
as snapshot of source_database_name
[;]
推荐阅读
-
mssql server CREATE DATABASE创建数据库代码
-
【SQL Server CE2.0】创建加密的数据库(源代码)
-
Sql Server 创建数据库脚本Create DATABASE
-
Sql Server 创建数据库脚本Create DATABASE
-
SQL server数据库创建代码,filegroup文件组修改,
-
Create database 创建数据库
-
SQL server数据库创建代码 filegroup文件组修改的示例代码
-
mssql server 创建数据库到存储过程与用户自定义函数
-
sql create database 创建数据库命令
-
在Navicat premium上创建的SQL Server数据库,实现用PHP连接(即php连接微软MSSQL),navicatpremium_PHP教程