SQL Server--怎样用ADO在SQL SERVER中建库,建表
程序员文章站
2022-05-18 11:15:21
通过ado可以访问sql server,并执行相应的sql语句建库、建表,下面是sql server books online中的相...
通过ado可以访问sql server,并执行相应的sql语句建库、建表,下面是sql server books online中的相关定义。
建表:
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)
}
建库:
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]
建表:
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)
}
建库:
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]
上一篇: 盆姐
下一篇: asp上传带显示的代码