Create a SQL Server database

Create a database in two ways:

1- way to create graphical interface:

1. Right click the "Database" and then click New Database

 

2. Set the General tab

  2.1 to the database name, generally use multiple words underscore the connection is not recommended by a space, such as Test_DB.

  2.2 'owner' default is the current server Administrator, click sa [...] to add to the mix, it is not simply a screenshot.

  Since the initial size and increment of 2.3 database files / log files by setting situation, enterprise applications generally do not set the maximum individual learning, then it does not matter.

  2.4 and then click OK to complete the new database.

  

 

 

 

] 2- use the Create Database statement to create:

 1 create database Test_DB                                --创建数据库
 2 
 3 on                                                     --主数据文件
 4 
 5 (
 6 name = test,                                           --文件名
 7 filename = 'E:\SQL Server\test_DB.mdf',               --文件路径
 8 size = 8mb,                                            --初始大小
 9 maxsize = unlimited,                                   --最大值
10 filegrowth = 3mb                                       --标识增量
11 )
12 log on                                                 --日志文件
13 (
14 name = test_log,                                       --日志文件名
15 filename = 'E:\SQL Server\test_DB.ldf',                --日志文件路径
16 size = 8mb,                                            --初始大小
17 maxsize = 1GB,                                         --最大值
18 filegrowth = 3mb                                       --自增量
19 )

 

以上代码是主要是数据文件和日志文件常见参数,其它参数可以从微软官网查找。另外collate参数说明一下,这个参数是应用于表达式、列定义或数据库定义的排序规则的名称,当不配置时,默认是当前windows的collate_name,当跨服务器串联数据时,可能会发生collate_name错误,到时候会需要强制转一下。

好困,睡觉。

Guess you like

Origin www.cnblogs.com/howie-we/p/12064738.html