Save up to 35%

How to create a database?

May 5th, 2005 by uCertify Leave a reply »

The following Transact SQL command is used to create a database:

CREATE DATABASE database_name
[ ON [PRIMARY]
        [ <filespec> [,...n] ]
        [, <filegroup> [,...n] ]
]
[ LOG ON { <filespec> [,...n]} ]
<filespec> ::=
( [ NAME = logical_file_name, ]
FILENAME = ‘os_file_name’
[, SIZE = size]
[, MAXSIZE = { max_size | UNLIMITED } ]
[, FILEGROWTH = growth_increment] ) [,...n]
<filegroup> ::=
FILEGROUP filegroup_name <filespec> [,...n]

where,

  • database_name is the name of the new database.
  • ON specifies that the disk files used to store the data sections of the database and data files are explicitly defined. ON is needed when followed by a comma-separated list of [filespec] items that define the data files for the primary filegroup. The list of files in the primary filegroup can be followed by an optional, comma-separated list of [filegroup] items that define user filegroups and their files.
  • PRIMARY specifies that the associated <filespec> list defines the primary file. The first file specified in the <filespec> entry in the primary filegroup becomes the primary file.
  • LOG ON specifies that the disk files used to store the database log and log files are explicitly defined. It is followed by a comma-separated list of items that define the log files.
  • NAME specifies the logical name for the file.
  • FILENAME specifies the operating system (physical) file name.
  • SIZE specifies the size of the file.
  • MAXSIZE specifies the maximum size to which the file can grow.
  • FILEGROWTH specifies the automatic growth increment of the file.
  • FILEGROUP is the logical name of the filegroup.
Like this article? Share it with others
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.
  • Share/Bookmark
Advertisement

Leave a Reply

uCertify.com | Our Company | Articles | Contact Us | News and Press Release | uCertify India | Entries (RSS)
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD    Cisco Certification: CCNA, CCENT    A+, Network+, Security+ Project+
Oracle Certification: OCP 11g, OCP 10g, OCA 11g, OCA 10g    CIW foundation    EC-212-32,    CISSP    Photoshop ACE CS4    Adobe Flash ACE, PMP, CAPM
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.