存储过程中将@@ ROWCOUNT设置为SET NOCOUNT ON

编程入门 行业动态 更新时间:2024-10-26 06:32:02
本文介绍了存储过程中将@@ ROWCOUNT设置为SET NOCOUNT ON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好! 刚才,我已经阅读了此文章 [ ^ ],并不确定如何使用@@ROWCOUNT来获取受影响的保持NOCOUNT ON的行数. 我已经在ASP.Net(C#)中对此进行了标记,因为我将其用作前端,并且无论是否可以执行此操作都需要一些指导. 我想知道受存储过程影响的行数,并据此执行代码.因此,即使保持NOCOUNT ON,是否有任何方法可以知道受存储过程影响的行数? 如果是,那是哪一个? 请帮助..

Hello everyone! Just now, I have read this Article[^] and have a doubt how to use @@ROWCOUNT to get affected number of rows keeping NOCOUNT ON. I have tagged this in ASP.Net(C#) as I am using it as the front end and need some guidance whether I can do this or not. I want to know the number of rows affected by the stored procedures and accordingly execute the codes. So, is there any way to know the number of rows affected by a stored procedure even after keeping NOCOUNT ON? If yes, then which one? Please help..

推荐答案

本文明确指出, The article clearly states, 报价:

如果仍然需要获取正在执行的T-SQL语句影响的行数,您仍然可以使用@@ ROWCOUNT选项.通过在此函数上发出SET NOCOUNT,该函数(@@ ROWCOUNT)仍然有效,并且仍可以在存储过程中使用,以标识该语句影响了多少行.

If you still need to get the number of rows affected by the T-SQL statement that is executing you can still use the @@ROWCOUNT option. By issuing a SET NOCOUNT ON this function (@@ROWCOUNT) still works and can still be used in your stored procedures to identify how many rows were affected by the statement.

返回行数 [ ^ ]值,并在前端使用它.

Return the ROWCOUNT[^] value from the stored procedure and use it in the front end.

对Rajeev发表评论后: 阅读此页,您将找到答案: msdn.microsoft/en-us/library/59x02y99%28v = vs.110%29.aspx [ ^ ] 希望对您有所帮助. After your comments for Rajeev : Read this page and you will find your answer : msdn.microsoft/en-us/library/59x02y99%28v=vs.110%29.aspx[^] Hope it helps.

更多推荐

存储过程中将@@ ROWCOUNT设置为SET NOCOUNT ON

本文发布于:2023-10-29 03:24:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538577.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设置为   过程中将   NOCOUNT   ROWCOUNT   SET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!