/*
Navicat SQL Server Data Transfer

Source Server         : 9000
Source Server Version : 105000
Source Host           : .\sqlexpress:1433
Source Database       : LHBMS
Source Schema         : dbo

Target Server Type    : SQL Server
Target Server Version : 105000
File Encoding         : 65001

Date: 2021-05-11 15:33:59
*/


-- ----------------------------
-- Table structure for PersonScope
-- ----------------------------
DROP TABLE [dbo].[PersonScope]
GO
CREATE TABLE [dbo].[PersonScope] (
[ID] int NOT NULL IDENTITY(1,1) ,
[DeviceID] uniqueidentifier NOT NULL DEFAULT (newid()) ROWGUIDCOL ,
[AreaType] int NULL ,
[AreaNo] int NULL DEFAULT ((0)) ,
[ZoneNo] int NULL DEFAULT ((0)) ,
[PersonID] uniqueidentifier NULL ,
[AreaName] nvarchar(50) NULL ,
[Remark] nvarchar(50) NULL 
)


GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'PersonScope', 
'COLUMN', N'AreaType')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'0：基本分区 1：键盘分区'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'PersonScope'
, @level2type = 'COLUMN', @level2name = N'AreaType'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'0：基本分区 1：键盘分区'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'PersonScope'
, @level2type = 'COLUMN', @level2name = N'AreaType'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'PersonScope', 
'COLUMN', N'AreaNo')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'防区名称'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'PersonScope'
, @level2type = 'COLUMN', @level2name = N'AreaNo'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'防区名称'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'PersonScope'
, @level2type = 'COLUMN', @level2name = N'AreaNo'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'PersonScope', 
'COLUMN', N'ZoneNo')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'所属分区'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'PersonScope'
, @level2type = 'COLUMN', @level2name = N'ZoneNo'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'所属分区'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'PersonScope'
, @level2type = 'COLUMN', @level2name = N'ZoneNo'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'PersonScope', 
'COLUMN', N'PersonID')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'所属使用者'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'PersonScope'
, @level2type = 'COLUMN', @level2name = N'PersonID'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'所属使用者'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'PersonScope'
, @level2type = 'COLUMN', @level2name = N'PersonID'
GO

-- ----------------------------
-- Records of PersonScope
-- ----------------------------
SET IDENTITY_INSERT [dbo].[PersonScope] ON
GO
SET IDENTITY_INSERT [dbo].[PersonScope] OFF
GO

-- ----------------------------
-- Indexes structure for table PersonScope
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table PersonScope
-- ----------------------------
ALTER TABLE [dbo].[PersonScope] ADD PRIMARY KEY ([ID])
GO
