大家好! 刚才,我已经阅读了此文章 [ ^ ],并不确定如何使用@@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
发布评论