有什么区别;和 GO 在 SQL Server 的存储过程中? [英] What is the difference between ; and GO in stored procedure in SQL Server?

查看:26
本文介绍了有什么区别;和 GO 在 SQL Server 的存储过程中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

;GO 在 SQL Server 中的存储过程有什么区别?

What is the difference between ; and GO in stored procedure in SQL Server ?

实际上,如果我在 SQL Server 中有一个存储过程并想在其中放置 t 个单独的查询,其中第一个查询只是计算记录数(计数),第二个查询根据某些条件选择一些记录,那么应该怎么做?我在这两个查询之间使用?

Actually, if I have a stored procedure in SQL server and wanna to put t separate queries inside it which the first one just calculates number of records (count) and the second one selects some records based on some conditions, then what should I use between that two queries?

Go;

推荐答案

; 只是结束语句.

GO 不是一条语句,而是一条命令,服务器将当前批处理提交到数据库.它在交易中创建了一个止损点.

GO is not a statement but a command to the server to commit the current batch to the Database. It creates a stop inside the transaction.

http://msdn.microsoft.com/en-us/library/ms188037.aspx

(更新,感谢评论):
据我所知,GO 是针对管理工作室的声明,可能也适用于其他工具.

(Update, thanks for the comments):
GO is a statement intended for the Management studio as far as I know, maybe to other tools as well.

这篇关于有什么区别;和 GO 在 SQL Server 的存储过程中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆