create database in sql server 2005

create database database_name
[ON
[PRIMARY] [<filespec> [,....n]
[,filegroup> [,....n]]

[LOG ON { <filespec>[,....n]}]
]
 [collate collation_name]
[with <external_access_option>]
]

[;]

TO ATTACH A DATABASE

CREATE DATABASE database_name
ON <filespec> [,.....n]
FOR {ATTACH [WITH <service_broker_option>]  |  ATTACH_REBUILD_LOG}

[;]

<filespec>::=
{

(name=logical_filename,
filename={'os_filename' | 'filestream path'}
[,size= {kb|mb|gb|tb]
[,maxsize={max_size[kb|mb|gb|tb]|unlimited}]

[,filegrowth=growth_increment[kb|mb|gb|tb|%]]
)[,...n]
}

<filegroup>::=
{
filegroup filegroup_name[contains filestream] [default] <filespec> [,...n]
}


<external_access_option>::=
{
[DB_CHAINING {ON|OFF}]
[,TRUSTWORTHY {ON|OFF}]
}

<service_broker_option>::=
{
ENABLE_BROKER | NEW_BROKER | ERROR_BROKER_CONVERSATIONS
}


create a database snapshot

create  database  database_snapshot_name
on
( name=logical_file_name,
filename='os_filename'
)[,..n]

[;]



Ebook Download
View all
Learn
View all