Begin
...
End
之间的是一个语句块,一般Begin...End用在  ( 相当于  {})
while
if等语句中
在T_SQL中,if/while后只能紧跟一条sql语句,如果有多条则应该用Begin..end包含起来
如:
if (@int > 9)
set @int = 1
else
set @int = 0
这里的if后面只把变量@int设为1,没有其它的操作,所以这里可以省去begin..end
但如果有多条,如
if(@int > 9)
begin
set @int = 1
select * from tablename
end
这里就必须用begin..end
否则
select语句就永远都会被执行一次

应用于mybatis  当有多个delete时 :

<delete id="deleteHdsqByProcessinstid">

BEGIN

delete from wfworkitem c where c.processinstid in (select b.processinstid from wfprocessinst b where b.PARENTPROCID=#processinstid#);
delete from wfactivityinst c where c.processinstid in (select b.processinstid from wfprocessinst b where b.PARENTPROCID=#processinstid#);
delete from wftransctrl e where e.processinstid in (select b.processinstid from wfprocessinst b where b.PARENTPROCID=#processinstid#);
delete from wftransition g where g.processinstid in (select b.processinstid from wfprocessinst b where b.PARENTPROCID=#processinstid#);
delete from wfwiparticipant i where i.processinstid in (select b.processinstid from wfprocessinst b where b.PARENTPROCID=#processinstid#);
delete from wfprocessinst a where a.processinstid in (select b.processinstid from wfprocessinst b where b.PARENTPROCID=#processinstid#);

delete from wfworkitem where processinstid=#processinstid#;
delete from wfactivityinst where processinstid=#processinstid#;
delete from wftransctrl where processinstid=#processinstid#;
delete from wftransition where processinstid=#processinstid#;
delete from wfwiparticipant where processinstid=#processinstid#;
delete from wfprocessinst where processinstid=#processinstid#;
END;
</delete>

sql中的begin....end的更多相关文章

  1. sql中的begin catch 。。。end catch 的用法

    begin catch ...end  catch 是用来处理异常的 begintry--SQLendtry begincatch--sql (处理出错动作)endcatch 我们将可能会出错的sql ...

  2. SQL 中的Begin...End语句

    Begin...End通常用来表示一个语句块,其内部的代码可以包含一组T-SQL语句,可以理解为高级语言中的{},这样在使用while循环时才知道判断什么时候结束.

  3. 在SQL中使用CLR提供基本函数对二进制数据进行解析与构造

      二进制数据包的解析一般是借助C#等语言,在通讯程序中解析后形成字段,再统一单笔或者批量(表类型参数)提交至数据库,在通讯程序中,存在BINARY到struct再到table的转换. 现借助CLR提 ...

  4. SQL中的循环、for循环、游标

    我们使用SQL语句处理数据时,可能会碰到一些需要循环遍历某个表并对其进行相应的操作(添加.修改.删除),这时我们就需要用到咱们在编程中常常用的for或foreach,但是在SQL中写循环往往显得那么吃 ...

  5. Qt调用Server SQL中的存储过程

    Server SQL中的存储过程如下: CREATE procedure PINSERTPC @pcnum int, @pcname varchar(50), @pctype int, @ipaddr ...

  6. SQL中查看数据库各表的大小

    SQL中查看数据库各表的大小 编写人:CC阿爸 2014-6-17 在日常SQL数据库的操作中,如何快速的查询数据库中各表中数据的大小. 以下有两种方法供参考: 第一种: create table # ...

  7. SQL中删除某数据库所有trigger及sp

    SQL中删除某数据库所有trigger及sp   编写人:CC阿爸 2014-6-14 在日常SQL数据库的操作中,如何快速的删除所有trigger及sp呢 以下有三种方式可快速处理. --第一种 - ...

  8. SQL中补0

     SQL中补0 编写人:CC阿爸 2014-3-14 第一种方法: right('00000'+cast(@count as varchar),5) 其中'00000'的个数为right函数的最后参数 ...

  9. 在SQL中取出字符串中数字部分或在SQL中取出字符部分

    在SQL中取出字符串中数字部分或在SQL中取出字符部分 编写人:CC阿爸 2013-10-18 近来在开发一个项目时,一包含数字的字符串,需要取出中间的数字部分进行排序.经过baidu搜索.并结合自己 ...

随机推荐

  1. EasyDSS流媒体解决方案之多方式虚拟直播方法

    EasyDSS_Solution虚拟直播 EasyDSS_Solution虚拟直播,是EasyDSS流媒体解决方案提供的虚拟直播方案.可以通过三种方式创建虚拟直播. (1)点播的视频文件: (2)本地 ...

  2. 【C#图解】PictureBox.SizeMode 属性(转)

    PictureBoxSizeMode.Normal: 默认情况下,在 Normal 模式中,Image 置于 PictureBox 的左上角,凡是因过大而不适合 PictureBox 的任何图像部分都 ...

  3. ruby 字符串

    字符串处理函数 1.返回字符串的长度 str.length => integer 2.判断字符串中是否包含另一个串 str.include? other_str => true or fa ...

  4. 近200篇机器学习&深度学习资料分享【转载】

    编者按:本文收集了百来篇关于机器学习和深度学习的资料,含各种文档,视频,源码等.而且原文也会不定期的更新,望看到文章的朋友能够学到更多. <Brief History of Machine Le ...

  5. git用远程库的内容覆盖本地

    git fetch --all 下载远程的库的内容到本地,不做任何的合并(怎么合并可以自己选择) git reset --hard origin/master 撤销本地.暂存区.版本库(用远程服务器的 ...

  6. BZOJ1833 数位DP

    数位DP随便搞搞. #include<iostream> #include<cstdio> #include<cstdlib> #include<cstrin ...

  7. LightOJ - 1284 Lights inside 3D Grid —— 期望

    题目链接:https://vjudge.net/problem/LightOJ-1284 1284 - Lights inside 3D Grid    PDF (English) Statistic ...

  8. ActivemMQ之消息服务器平台(发邮件)

    消息服务平台 处理公司内部各种消息业务 比如 发送邮件  发送短信  微信推送 接口有两种类型 异步 同步 同步需求: 当调用消息服务平台,需要返回消息服务平台调用第三方平台接口是否成功 异步需求: ...

  9. [转]aliyun阿里云Maven仓库地址——加速你的maven构建

    原文链接:http://www.cnblogs.com/geektown/p/5705405.html maven仓库用过的人都知道,国内有多么的悲催.还好有比较好用的镜像可以使用,尽快记录下来.速度 ...

  10. ffmpeg拼接mp4视频

    首先需要把mp4格式的文件转成ts格式.拼接好之后,再将ts封装格式转换回mp4. ffmpeg -i 1.mp4 -vcodec copy -acodec copy -vbsf h264_mp4to ...