sql server 2000 新建表的SQL语句

来源:百度知道 编辑:UC知道 时间:2024/07/02 20:45:54

create table 表名
(
字段名 字段类型
字段名 字段类型
字段名 字段类型
字段名 字段类型
. .
. .
. .

)

insert into 表名
values()

if exists(select name from sysobjects where name='表名1' and type='u')
drop table 表名1

--if exists(select name from sysobjects where name='Table' and xtype='p')

if exists (select * from sysobjects where id = object_id(N'Table') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table Table --Table 为表名

create table Table(
字段名 类型[primary key][not null]
[constrant],
...
...
)

这只是最基本的建表语句,如果其它要求请查看SQL中建表的完整语句。
附SQLServer2005建表完整语句:
CREATE TABLE
[ database_name . [ schema_name ] . | schema_name . ] table_name
( { <column_definition> | <computed_column_definition> }
[ <table_constraint> ] [ ,...n ] )
[ ON { pa