mssql2000 database execution SQL statements to create databases and data tables and indexes

Source: Internet
Author: User

mssql2000 database execution SQL statements to create databases and data tables and indexes

Create a database 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


Deleting a database
Drop database DatabaseName

Create a data table
CREATE TABLE [dbo]. [T_rewards] (
[ID] [int] IDENTITY (1, 1) not NULL,
[ItemName] [nvarchar] (COLLATE) Chinese_prc_ci_as NULL,
[Itemnum] [INT] Null
[Radbig] [INT] Null
[Radsmall] [INT] Null
[Uptable] [nvarchar] (COLLATE) Chinese_prc_ci_as NULL,
[Uptype] [tinyint] Null
) on [PRIMARY]

Create primary key Alter table T_rewards Add primary key (ID)
Delete primary key Alter table T_rewards drop PRIMARY key (ID)


Creating an index 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

Create a unique index ALTER TABLE t_rewards add constraint pk_t_rewardsitemname unique (itemname)

mssql2000 database execution SQL statements to create databases and data tables and indexes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.