当前位置: 移动技术网 > IT编程>开发语言>Asp > SQL Server--怎样用ADO在SQL SERVER中建库,建表

SQL Server--怎样用ADO在SQL SERVER中建库,建表

2017年12月12日  | 移动技术网IT编程  | 我要评论
通过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] 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网