mssql2000数据库执行SQL语句来创建数据库以及数据表还有索引
mssql2000数据库执行SQL语句来创建数据库以及数据表还有索引
创建数据库MSsql2000
Create DATABASE databasename on primary
(name=‘databasename_data‘,filename=‘C:\databasename_data.mdf‘,size=3mb,maxsize=UNLIMITED,filegrowth=10%)log on
(name=‘databasename_log‘,filename=‘C:\databasename_log.ldf‘,size=3mb,filegrowth=10%)
CREATE DATABASE [dbname] ON PRIMARY ( NAME = N‘dbname_data‘, FILENAME = N‘C:\dbname_data.mdf‘ , SIZE = 3072KB , MAXSIZE =
UNLIMITED ,FILEGROWTH = 1024KB )LOG ON ( NAME = N‘dbname_log‘, FILENAME = N‘C:\dbname_log.ldf‘ , SIZE = 1024KB , MAXSIZE =
UNLIMITED ,FILEGROWTH = 10%) COLLATE Chinese_PRC_90_CS_AI
删除数据库
drop database databasename
创建数据表
CREATE TABLE [dbo].[t_rewards] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[itemname] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[itemnum] [int] NULL ,
[radbig] [int] NULL ,
[radsmall] [int] NULL ,
[uptable] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[uptype] [tinyint] NULL
) ON [PRIMARY]
创建主键 Alter table t_rewards add primary key(id)
删除主键 Alter table t_rewards drop primary key(id)
创建索引 create unique index PK_t_rewardsuptype on t_rewards(uptype)
删除索引 drop index PK_t_rewardsuptype on t_rewards
删除索引 drop index t_rewards.PK_t_rewardsuptype
创建唯一索引 alter table t_rewards add constraint PK_t_rewardsitemname unique(itemname)
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。