预约会议sql
@serialno varchar(max)='', ---- 主档serialno
@title nvarchar(200)='',--会议主题
@buser nvarchar(50)='' --建档人
as
declare @Result varchar(max)
declare @sdate datetime
declare @edate datetime
declare @stime datetime
declare @etime datetime
declare @shour nvarchar(50)
declare @ehour nvarchar(50)
declare @sdate1 datetime
declare @edate1 datetime
declare @stime1 datetime
declare @etime1 datetime
declare @shour1 nvarchar(50)
declare @ehour1 nvarchar(50)
declare @adress nvarchar(100)
--INSERT INTO A1(A1) VALUES('1')
set xact_abort on
begin transaction --select * from A1 delete from A1
begin
set @Result='SUCCESS'
-----------获取当前单据相关数据------
select
@sdate=MeetingDate,
@edate=MeetingDate2,
@stime=cast(convert(varchar(50),MeetingDate,23)+' '+startDatetime as datetime),
@etime=cast(convert(varchar(50),MeetingDate2,23)+' '+endDatetime as datetime),
@shour=startDatetime,
@ehour=endDatetime,
@adress=MeetingAdress
from t_OA_meetingApply where serialno=@serialno
------------对比最前已审核10张单,用游标做对比-----
select top 10
MeetingDate,isnull(MeetingDate2,MeetingDate) MeetingDate2,
cast(convert(varchar(50),MeetingDate,23)+' '+startDatetime as datetime) stime1,
cast(convert(varchar(50),isnull(MeetingDate2,MeetingDate),23)+' '+endDatetime as datetime) etime1,
startDatetime,endDatetime
into #mttmp1 from t_OA_meetingApply where MeetingAdress=@adress
and checked=1 order by stime1 desc
--------------------------------------
declare cur cursor for
select MeetingDate,MeetingDate2,stime1,etime1,startDatetime,endDatetime from #mttmp1
for read only
open cur
fetch cur into @sdate1,@edate1,@stime1,@etime1,@shour1,@ehour1
while @@fetch_status=0
begin
--set @Result='SUCCESS'
--@sdate1,@edate1 不带时间
--@stime1,@etime1 带时间
--@shour1,@ehour1 小时与分钟 字串 如09:30
if(@sdate=@edate) --日期相同
begin
--if(@edate=@sdate1 or @edate=@edate1)
--begin
if(@stime=@etime1 or @etime=@etime1) --相等时间
begin
set @Result='会议时间有重复,不能预定!'
end
else if((@stime>@stime1 and @stime<@etime1) and (@etime>@stime1 and @etime<@etime1)) --中间时间
begin
set @Result='会议时间有包含,不能预定!'
end
else if(@stime<@stime1 and @etime>@etime1) --两边时间
begin
set @Result='会议时间有包含,不能预定!'
end
else if(@stime<@stime1 and @etime>@stime1)
begin
set @Result='会议时间有包含,不能预定!'
end
else if(@stime<@etime1 and @etime>@etime1)
begin
set @Result='会议时间有包含,不能预定!'
end
else if((@stime<@stime1 and @etime<@stime1) or (@stime>@etime1 and @etime>@etime1))
begin
set @Result='SUCCESS'
end
else
begin
set @Result='SUCCESS'
end
if(@Result<>'SUCCESS')
begin
--return
break
end
--end
end
预约会议sql的更多相关文章
- SQL存储过程-新增和修改,参数Xml数据类型
输入参数:xml数据类型 功能:新增和修改 --value() 方法从 XML 中检索 rogue 属性值.然后将该值分配给 int 变量. --将 Member 节点拆分成多行 SELECT T ...
- Sql语法高级应用之五:使用存储过程实现对明细多层次统计
前言 前面章节我们讲到了存储过程的基础用法,本章则将一个在项目中实际应用的场景. 在项目中经常会存在这样的需求,例如需要对明细列表进行按组.按级别.按人等进行统计,如果在附带列表的查询条件,又如何实现 ...
- 会议通js
js逻辑: /** * Created by wanglijuan on 2016/12/2. */ $(function () { //登陆后请求数据 // $.ajax({ // url:&quo ...
- Google I/O 官方应用中的动效设计
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/jILRvRTrc/article/details/82881743 作者:Nick Butcher, ...
- Odoo,快速上手Odoo,来了解Odoo几个标准模块
odoo通过Apps和Connector扩展和集成数以万计的应用和服务,odoo目前有超过12500个Apps可选用.它囊括了项目管理,生产.财务.记账和销售管理,仓储管理,人力资源管理,等等项目.本 ...
- 小鱼易连 for mac如何使用?小鱼易连 mac版使用教程
小鱼易连 for mac如何使用?小鱼易连 mac版是参加远程会议人士的首选,高效极致,简单流畅,视频流畅,语音清晰,无需专用网络的功能深受用户的喜欢,它提供的文件和电脑的共享,让你的会议更加高效.下 ...
- 怎样管理Exchange Server 2013资源邮箱
1. exchange资源邮箱介绍 这次将介绍Exchange Server 2013的资源邮箱相关内容. Exchange Server 2013的资源邮箱包含两类,其一为“会议室邮箱”,另一类是“ ...
- 图书管理系统(Java实现,十个数据表,含源码、ER图,超详细报告解释,2020.7.11更新)
图书管理系统数据库设计实验报告 文章目录 更新日志 1.概述 2.需求分析 2.1需要实现的功能 2.2业务流程图 2.2.1学生流程图 2.2.2管理员流程图 2.2.3超级管理员流程图 2.3功能 ...
- SQL 会议消费记录统计
统计 /****** Object: Procedure [dbo].[JOB_UP_Summit_UserConfStat] Script Date: 2014-3-17 10:00:50 **** ...
随机推荐
- 用eclipes 添加jboss tools中的hibernate tool进行反向工程生成数据库对应的BOJO(Javabean)
用eclipes 添加jboss tools中的hibernate tool进行反向工程生成数据库对应的BOJO(Javabean) 安装: 在help中eclise marksplace中查询JBo ...
- 【转载】google搜索从入门到精通
原文地址:http://www.cnblogs.com/helloIT/articles/5095668.html /***************************************** ...
- javascript——数据类型
在内存中,分为栈.堆.代码段.静态区,为了快速处理复杂的代码,在不同的区间储存不同的数据类型. 数据类型分为初始类型与引用类型,初始类型在栈中存储,变量赋值传值不传址,引用类型在堆中存储,传址不传值. ...
- Linux Shell——函数的使用
文/一介书生,一枚码农. scripts are for lazy people. 函数是存在内存里的一组代码的命名的元素.函数创建于脚本运行环境之中,并且可以执行. 函数的语法结构为: functi ...
- MVC 5 + EF6 完整教程16 -- 控制器详解
Controller作为持久层和展现层的桥梁, 封装了应用程序的逻辑,是MVC中的核心组件之一. 本篇文章我们就来谈谈 Controller, 主要讨论两个方面: Controller运行机制简介 C ...
- Mongodb以及rockmongo安装
Mongodb安装 以centos6.x_x_64位系统为例,我们使用yum安装 1.添加yum源 在/etc/yum.repos.d/目录下创建文件10genmon.repo(名字随意,.repo结 ...
- 用react系列技术栈实现的demo整合系统
引子 学生时代为了掌握某个知识点会不断地做习题,做总结,步入岗位之后何尝不是一样呢?做业务就如同做习题,如果‘课后’适当地进行总结,必然更快地提升自己的水平. 由于公司采用的react+node的技术 ...
- hdu1420 Prepared for New Acmer 简单数学
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1420 简单数学题 第一次wa在可能和会出现取模后值为负数的情况. 只要会一个数论上的简单公式(a*b) ...
- MFC基础程序设计VS2015 最新03
视频教程地址观看:http://pan.baidu.com/s/1mhKQ6kK 一.数字(浮点数或整数)转为文字:a)如果转为窄字符字符串,sprintf函数很好用,浮点数都没问题:b)如果转为宽字 ...
- 学习笔记:javascript 文档对象(document)
1.documnet函数 方法 描述 close() 关闭用 document.open() 方法打开的输出流,并显示选定的数据. getElementById() 返回对拥有指定 id 的第一个对象 ...