mysql存储过程语句(一)

2014-11-24 11:59:25 · 作者: · 浏览: 0
001
set @Prov_Code:=32;
002
set @Prov_Name="省厅";
003
set @Area_Code:=3201;
004
set @Area_Name="市局";
005 www.2cto.com
006
007
SET FOREIGN_KEY_CHECKS=0;
008
-- ----------------------------
009
-- Table structure for `AlertInfo`
010
-- ----------------------------
011
DROP TABLE IF EXISTS `AlertInfo`;
012
CREATE TABLE `AlertInfo` (
013
`AlertID` bigint(20) NOT NULL auto_increment COMMENT '唯一、非空、自增、主键',
014
`DeviceID` bigint(20) default NULL COMMENT '告警设备的安装单位的单位编号',
015 www.2cto.com
`LineIDOnDevice` bigint(20) default NULL COMMENT '该线路在录音设备上的线路编号',
016
`AlertDate` datetime default NULL COMMENT '告警日期,仅日期有效,时间为00:00:00',
017
`AllCallCount` int(10) default NULL COMMENT '当天总通话次数',
018
`TimeOutCount` int(10) default NULL COMMENT '当天通话超时次数',
019
`LineLostCount` int(10) default NULL COMMENT '当前断线次数',
020
`ComfirmAlert` tinyint(4) default '0' COMMENT '告警是否已经确认',
021
PRIMARY KEY (`AlertID`)
022
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='告警信息表';
023
024
-- ----------------------------
025
-- Records of AlertInfo
026
-- ----------------------------
027
028
-- ----------------------------
029
-- Table structure for `DepartDescInfo`
030
-- ----------------------------
031
DROP TABLE IF EXISTS `DepartDescInfo`;
032
CREATE TABLE `DepartDescInfo` (
033
`DepartClass` bigint(20) NOT NULL COMMENT '单位级别',
034
`DepartDesc` varchar(50) default NULL COMMENT '单位级别描述',
035
PRIMARY KEY (`DepartClass`)
036
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='部门级别名称描述信息表';
037
038
-- ----------------------------
039
-- Records of DepartDescInfo
040
-- ----------------------------
041 www.2cto.com
INSERT INTO DepartDescInfo VALUES ('1', '市局');
042
INSERT INTO DepartDescInfo VALUES ('2', '区分局');
043
INSERT INTO DepartDescInfo VALUES ('3', '派出所');
044
045
-- ----------------------------
046
-- Table structure for `DepartInfo`
047
-- ----------------------------
048
DROP TABLE IF EXISTS `DepartInfo`;
049
CREATE TABLE `DepartInfo` (
050
`DepartID` bigint(20) NOT NULL COMMENT '单位编号',
051
`DepartName` varchar(50) default NULL COMMENT '单位名称',
052
PRIMARY KEY (`DepartID`)
053
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='部门信息表';
054
055
-- ----------------------------
056
-- Records of DepartInfo
057
-- ----------------------------
058
INSERT INTO DepartInfo VALUES (concat(@Prov_Code,'000000'),@Prov_Name);
059
INSERT INTO DepartInfo VALUES (concat(@Area_Code,'0000'),@Area_Name);
060
061
-- ----------------------------
062
-- Table structure for `DeviceConnect`
063 www.2cto.com
-- ----------------------------
064
DROP TABLE IF EXISTS `DeviceConnect`;
065
CREATE TABLE `DeviceConnect` (
066
`ConnectID` bigint(20) NOT NULL auto_increment COMMENT '唯一、非空、自增、主键',
067
`DeviceID` bigint(20) default NULL COMMENT '设备ID',
068
`ConnectDate` datetime default NULL COMMENT '告警日期',
069
`ConnectStatus` int(20) default NULL COMMENT '告警状态',
070
`ComfirmAlert` tinyint(4) default '0' C