Creation of a Database : Create Database « Database « SQL Server / T-SQL Tutorial






This statement has the general form:
      CREATE DATABASE db_name
        [ON [PRIMARY] file_spec1 {, file_spec2} ...]
        [LOG ON file_spec3 {, file_spec4 ...]
        [COLLATE collation_name]
      [FOR {ATTACH|ATTACH_REBUILD_LOG{]

db_name is the name of the database. 
The maximum size of a database name is 128 characters.
The maximum number of databases managed by a single SQL Server system is 32,767.
All databases in SQL Server are stored in files. 
These files can be explicitly specified by the system administrator or implicitly provided by the system. 
If the ON option exists in the CREATE DATABASE statement, all files containing the data of a database are explicitly specified.








19.1.Create Database
19.1.1.Creation of a Database
19.1.2.A CREATE DATABASE Example
19.1.3.create and drop database
19.1.4.If a database exists
19.1.5.A statement that attaches an existing database file
19.1.6.Create a database by specifying the mdf file
19.1.7.Create a database by indicating the mdf file
19.1.8.Attach a mdf file to database
19.1.9.Creates a database with explicit specifications for database and transaction log files.