SQL Server-how to use ADO to create databases and tables in SQL Server

Source: Internet
Author: User
Tags filegroup sql server books

You can access SQL Server through ado, and execute corresponding SQL statements to create databases and tables. The following are definitions in SQL Server books online.

Table creation:

Create Table
[
Database_name. [owner].
| Owner.
] Table_name
(
{
| Column_name as computed_column_expression

} [,... N]
)
[On {filegroup | default}]
[Textimage_on {filegroup | default}]

::={ Column_name data_type}
[[Default constant_expression]
| [Identity [(seed, increment) [not for replication]
]
[Rowguidcol]
[] [... N]

: = [Constraint constraint_name]
{
[Null | not null]
| [{Primary key | unique}
[Clustered | nonclustered]
[With fillfactor = fillfactor]
[On {filegroup | default }}
]
| [[Foreign key]
References ref_table [(ref_column)]
[Not for replication]
]
| Check [not for replication]
(Logical_expression)
}

: = [Constraint constraint_name]
{
[{Primary key | unique}
[Clustered | nonclustered]
{(Column [,... n])}
[With fillfactor = fillfactor]
[On {filegroup | default}]
]
| Foreign key
[(Column [,... n])]
References ref_table [(ref_column [,... n])]
[Not for replication]
| Check [not for replication]
(Search_conditions)
}

Database creation:

Create Database database_name
[On [primary]
[[,... N]
[, [,... N]
]
[Log on {[,... n]}]
[For Load | for attach]

: =

([Name = logical_file_name,]
Filename = 'OS _ file_name'
[, Size = size]
[, Maxsize = {max_size | unlimited}]
[, Filegrowth = growth_increment]) [,... n]

: =

Filegroup filegroup_name [,... n]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.