begin--end和go

GO is like the end of a script.

You could have multiple CREATE TABLE statements, separated by GO. It‘s a way of isolating one part of the script from another, but submitting it all in one block.

BEGIN and END are just like { and } in C/++/#, Java, etc.

They bound a logical block of code. I tend to use BEGIN and END at the start and end of a stored procedure, but it‘s not strictly necessary there. Where it IS necessary is for loops, and IF statements, etc, where you need more then one step...

IF EXISTS (SELECT * FROM my_table WHERE id = @id)
BEGIN
   INSERT INTO Log SELECT @id, ‘deleted‘
   DELETE my_table WHERE id = @id
END

http://stackoverflow.com/questions/1180279/when-do-i-need-to-use-begin-end-blocks-and-the-go-keyword-in-sql-server
时间: 2024-08-09 01:34:05

begin--end和go的相关文章

[原创]MySQL下关于begin或start transaction是否真正开启新事务的探索?

Server version:         5.6.21-log MySQL Community Server (GPL) 前提提要: 我们知道MySQL的RR(repeatable read)隔离级别下,事务无法看到正在活跃的事务所做的操作包括提交后的. 一般手动开启事务的命令是begin或start transaction:我以前的理解是一旦执行这条语句就已经开启了事务,也就是事务id已经生成(可用于MVCC版本比较),事务A和事务B一起执行begin,事务A的所有操作的提交事务B都看不

debian下安装vundle出现unknow function begin 错误解决

首先说下我的原因 是因为配置中 set nocompatible " be iMproved, required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim    //这里设置错误了 call vundle#begin() " alternatively, pass a path wh

十一、 C++特性之begin()与end()

非成员begin()和end() 也许你注意到了,我在前面的例子中已经用到了非成员begin()和end()函数.他们是新加入标准库的,除了能提高了代码一致性,还有助于更多 地使用泛型编程.它们和所有的STL容器兼容.更重要的是,他们是可重载的.所以它们可以被扩展到支持任何类型.对C类型数组的重载已经包含在标准库中 了. 我们还用上一个例子中的代码来说明,在这个例子中我打印了一个数组然后查找它的第一个偶数元素.如果std::vector被替换成C类型数组.代码可能看起来是这样的: 1 int a

Unity3d TweenPosition.Begin()的使用浅析

欢迎来到unity学习.unity培训.unity企业培训教育专区,这里有很多U3D资源.U3D培训视频.U3D教程.U3D常见问题.U3D项目源码,我们致力于打造业内unity3d培训.学习第一品牌. 当调用TweenPosition.Begin()时,gameObject会被自动挂上TweenPosition脚本 //让gameObject在20内移到坐标(4, 0, 0) TweenPosition tween = TweenPosition.Begin(gameObject, 20, n

(转)unbalanced calls to begin/end appearance transitions for uiviewcontroller的解决方法

iOS5 UIViewController加入了管理UIViewController的功能,就像管理subview一样方便.这儿有一博文介绍得很清楚.我在项目中用到了它,方便view的切换.下面的代码有一种fade in/out的效果. [self transitionFromViewController:_currentVC toViewController:newVC duration:0.5 options:UIViewAnimationOptionTransitionCrossDisso

Winform 关于委托与Invoke和Begin Invoke的使用

这方面的文章已经写得很详细了,特地摘引两篇文章 http://www.cnblogs.com/c2303191/articles/826571.html http://www.cnblogs.com/EasonLeung/p/3683492.html http://www.cnblogs.com/Rustle/articles/11301.aspx 然后我想把自己的理解记录下来,做一个笔记. 1.Control的Invoke和BeginInvoke的委托方法是在主线程,即UI线程上执行的,异步是

hdu 5978 To begin or not to begin

To begin or not to begin Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 765    Accepted Submission(s): 492 Problem Description A box contains black balls and a single red ball. Alice and Bob dr

latex排除\par \begin {document}

when you use latex to complile your paper, sometimes you may get the error: File ended while scanning use of \@input. <inserted text> \par 1.28 \begin {document} At this time, you can delete the temporary files, such as .aux file. Then, you can star

事务操作(BEGIN/COMMIT/ROLLBACK/SAVE TRANSACTION)

BEGIN TRANSACTION 标记一个显式本地事务的起始点. BEGIN TRANSACTION 使 @@TRANCOUNT 按 1 递增. BEGIN TRANSACTION 代表一点,由连接引用的数据在该点逻辑和物理上都一致的. 如果遇上错误,在 BEGIN TRANSACTION 之后的所有数据改动都能进行回滚,以将数据返回到已知的一致状态. 每个事务继续执行直到它无误地完成并且用 COMMIT TRANSACTION 对数据库作永久的改动,或者遇上错误并且用 ROLLBACK TR

vim 实现begin end 配对 使用matchit插件

matchit这个插件,是vim自带的,但是默认不安装.在vim中默认可以用%来实现括号之间的跳转,但是有了这个插件可以设置任意想跳转的标记. 在linux中敲vi打开一个空白的文件 :help matchit-install 可以看到安装matchit的步骤 就是在cd.vim文件夹下 mkdir ~/.vim/plugin  cp $VIMRUNTIME/macros/matchit.vim ~/.vim/plugin mkdir ~/.vim/doc  cp $VIMRUNTIME/mac