BranchInfo.sql 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. -- =============================================
  2. -- 程序编写: Jeff
  3. -- 版 本: V 1.0
  4. -- 建立日期: 2015-04-09
  5. -- 功能说明: 创建分店表[BranchInfo],记录所有分店信息;(以后可以扩展其中的信息,如:分店负责人,分店地址,分店电话等)
  6. -- 备 注:
  7. -- 修改日期:
  8. -- 修改说明:
  9. -- =============================================
  10. use [ddf]
  11. go
  12. set ansi_nulls on
  13. go
  14. set quoted_identifier on
  15. go
  16. set ansi_padding on
  17. go
  18. --判断表是否存在,不存在则创建;
  19. if not exists(select * from dbo.sysobjects where id = object_id(N'BranchInfo') and objectproperty(id,'IsTable') = 1)
  20. begin
  21. create table [dbo].[BranchInfo](
  22. [id] [int] identity(1,1) not null, /* 分店id */
  23. [branch] [nvarchar](16) not null, /* 分店名称 */
  24. [domain] [nvarchar](32) not null, /* 分店域名 */
  25. [publicIP] [nvarchar](40) not null, /* 公网IP(兼容IPV6长度) */
  26. -- 设置主键;
  27. constraint [PK_BranchInfo_id] primary key clustered
  28. (
  29. [id] asc
  30. ) with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off,allow_row_locks = on,allow_page_locks = on) on [primary],
  31. -- 设置UNIQUE约束键;
  32. constraint [PK_BranchInfo_u] unique nonclustered
  33. (
  34. [domain] asc
  35. ) with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off,allow_row_locks = on,allow_page_locks = on) on [primary]
  36. ) on [primary]
  37. end
  38. --设置id为主键;
  39. --alter table [BranchInfo] add constraint [PK_BranchInfo_id] primary key clustered([id]) on [primary]
  40. --设置UNIQUE约束键;
  41. --alter table [BranchInfo] add constraint [PK_BranchInfo_U] unique([domain]) on [primary]
  42. go
  43. set ansi_padding off