12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- -- =============================================
- -- 程序编写: Jeff
- -- 版 本: V 1.0
- -- 建立日期: 2015-04-09
- -- 功能说明: 创建分店表[BranchInfo],记录所有分店信息;(以后可以扩展其中的信息,如:分店负责人,分店地址,分店电话等)
- -- 备 注:
- -- 修改日期:
- -- 修改说明:
- -- =============================================
- use [ddf]
- go
- set ansi_nulls on
- go
- set quoted_identifier on
- go
- set ansi_padding on
- go
- --判断表是否存在,不存在则创建;
- if not exists(select * from dbo.sysobjects where id = object_id(N'BranchInfo') and objectproperty(id,'IsTable') = 1)
- begin
- create table [dbo].[BranchInfo](
- [id] [int] identity(1,1) not null, /* 分店id */
- [branch] [nvarchar](16) not null, /* 分店名称 */
- [domain] [nvarchar](32) not null, /* 分店域名 */
- [publicIP] [nvarchar](40) not null, /* 公网IP(兼容IPV6长度) */
-
- -- 设置主键;
- constraint [PK_BranchInfo_id] primary key clustered
- (
- [id] asc
- ) with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off,allow_row_locks = on,allow_page_locks = on) on [primary],
- -- 设置UNIQUE约束键;
- constraint [PK_BranchInfo_u] unique nonclustered
- (
- [domain] asc
- ) with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off,allow_row_locks = on,allow_page_locks = on) on [primary]
- ) on [primary]
- end
- --设置id为主键;
- --alter table [BranchInfo] add constraint [PK_BranchInfo_id] primary key clustered([id]) on [primary]
- --设置UNIQUE约束键;
- --alter table [BranchInfo] add constraint [PK_BranchInfo_U] unique([domain]) on [primary]
- go
- set ansi_padding off
|