/*
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:06
*/


-- ----------------------------
-- Table structure for Device
-- ----------------------------
DROP TABLE [dbo].[Device]
GO
CREATE TABLE [dbo].[Device] (
[ID] uniqueidentifier NOT NULL DEFAULT (newid()) ROWGUIDCOL ,
[Name] nvarchar(50) NOT NULL ,
[SN] nvarchar(50) NULL ,
[DevTypeID] uniqueidentifier NULL ,
[IPAddress] nvarchar(50) NULL ,
[Port] int NULL DEFAULT ((0)) ,
[Status] tinyint NULL DEFAULT ((0)) ,
[Location] nvarchar(50) NULL ,
[Telphone] nvarchar(50) NULL ,
[Owner] nvarchar(50) NULL ,
[OrgzID] uniqueidentifier NULL ,
[Deployer] nvarchar(50) NULL ,
[DeployerPhone] nvarchar(50) NULL ,
[DeployUnit] nvarchar(50) NULL ,
[DeployDate] datetime NULL ,
[Remark] nvarchar(100) NULL ,
[CommType] tinyint NOT NULL DEFAULT ((0)) ,
[ComNo] int NULL ,
[BaudRate] int NULL 
)


GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'Device', 
'COLUMN', N'SN')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'主机序列号'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'Device'
, @level2type = 'COLUMN', @level2name = N'SN'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'主机序列号'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'Device'
, @level2type = 'COLUMN', @level2name = N'SN'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'Device', 
'COLUMN', N'Status')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'0：离线 ，1：在线'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'Device'
, @level2type = 'COLUMN', @level2name = N'Status'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'0：离线 ，1：在线'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'Device'
, @level2type = 'COLUMN', @level2name = N'Status'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'Device', 
'COLUMN', N'Owner')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'负责人'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'Device'
, @level2type = 'COLUMN', @level2name = N'Owner'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'负责人'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'Device'
, @level2type = 'COLUMN', @level2name = N'Owner'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'Device', 
'COLUMN', N'DeployUnit')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'安装单位'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'Device'
, @level2type = 'COLUMN', @level2name = N'DeployUnit'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'安装单位'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'Device'
, @level2type = 'COLUMN', @level2name = N'DeployUnit'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'Device', 
'COLUMN', N'CommType')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'0: IP 1: Com'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'Device'
, @level2type = 'COLUMN', @level2name = N'CommType'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'0: IP 1: Com'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'Device'
, @level2type = 'COLUMN', @level2name = N'CommType'
GO

-- ----------------------------
-- Records of Device
-- ----------------------------

-- ----------------------------
-- Indexes structure for table Device
-- ----------------------------

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