Home > Database > Mysql Tutorial > mssql server CREATE DATABASE创建数据库代码

mssql server CREATE DATABASE创建数据库代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:47:26
Original
1384 people have browsed it

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 ] [ [ ,...n ]
        [ , [ ,...n ] ]
    [ log on { [ ,...n ] } ] }
    ]
    [ collate collation_name ]
    [ with ]
]
[;]

to attach a database
create database database_name
    on [ ,...n ]
    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 ]
    [ ,...n ]
}

::=
{
  [ 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
[;]

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template