SQL Server--怎样用ADO在SQL SERVER中建库,建表
通过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]
您可能感兴趣的文章:- sql server建库、建表、建约束技巧
- mysql建库时提示Specified key was too long max key length is 1000 bytes的问题的解决方法
- Mysql 建库建表技巧分享
- 详解在MySQL中创建表的教程
- mysql建表常用sql语句个人经验分享
- Oracle新建用户、角色,授权,建表空间的sql语句
- SQL Server 2008 阻止保存要求重新创建表的更改问题的设置方法
- 必须会的SQL语句(二) 创建表、修改表结构、删除表
- 一条SQL语句修改多表多字段的信息的具体实现
- 用SQL语句添加删除修改字段、一些表与字段的基本操作、数据库备份等
- 用sql命令修改数据表中的一个字段为非空(not null)的语句
- SqlServer编写数据库表的操作方式(建库、建表、修改语句)