sqlserver中的nocount on 和nocount off到底有什么区别?
1个回答
展开全部
insert into t values(1)
insert into t values(2)go--设置为off
set nocount offgoupdate t set col=1
--在messages栏会返回:(2 row(s) affected)设置为ONset nocount ongoupdate t set col=1
--在messages栏只回返:Command(s) completed successfully.
这个设置不会影响运行结果。
联机帮助里也写明了它的作用:
SET NOCOUNT ON prevents the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. When you are using the utilities provided with SQL Server 2005 to execute queries, the results prevent
nn rows affected
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询