SQL Server--怎样用ADO在SQL SERVER中建库,建表
2018-09-06 12:41
通过ADO可以访问SQLSERVER,并执行相应的SQL语句建库、建表,下面是SQLSERVERBOOKSONLINE中的相关定义。
建表:
CREATETABLE
[
database_name.[owner].
owner.
]table_name
(
{
column_nameAScomputed_column_expression
}[,...n]
)
[ON{filegroupDEFAULT}]
[TEXTIMAGE_ON{filegroupDEFAULT}]
::={column_namedata_type}
[[DEFAULTconstant_expression]
[IDENTITY[(seed,increment)[NOTFORREPLICATION]]]
]
[ROWGUIDCOL]
[][...n]
::=[CONSTRAINTconstraint_name]
{
[NULLNOTNULL]
[{PRIMARYKEYUNIQUE}
[CLUSTEREDNONCLUSTERED]
[WITHFILLFACTOR=fillfactor]
[ON{filegroupDEFAULT}}
]
[[FOREIGNKEY]
REFERENCESref_table[(ref_column)]
[NOTFORREPLICATION]
]
CHECK[NOTFORREPLICATION]
(logical_expression)
}
::=[CONSTRAINTconstraint_name]
{
[{PRIMARYKEYUNIQUE}
[CLUSTEREDNONCLUSTERED]
{(column[,...n])}
[WITHFILLFACTOR=fillfactor]
[ON{filegroupDEFAULT}]
]
FOREIGNKEY
[(column[,...n])]
REFERENCESref_table[(ref_column[,...n])]
[NOTFORREPLICATION]
CHECK[NOTFORREPLICATION]
(search_conditions)
}
建库:
CREATEDATABASEdatabase_name
[ON[PRIMARY]
[[,...n]]
[,[,...n]]
]
[LOGON{[,...n]}]
[FORLOADFORATTACH]
::=
([NAME=logical_file_name,]
FILENAME=os_file_name
[,SIZE=size]
[,MAXSIZE={max_sizeUNLIMITED}]
[,FILEGROWTH=growth_increment])[,...n]
::=
FILEGROUPfilegroup_name[,...n]
上一篇:Asp类型转换函数 函数类型转换
下一篇:asp页面实现301重定向方法
文章标题:SQL Server--怎样用ADO在SQL SERVER中建库,建表
文章链接:http://soscw.com/index.php/essay/10574.html