且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

得到没有. SQL Server 2005中运行选择查询后受影响的行数

更新时间:2023-02-07 18:26:17

将@@ ROWCOUNT捕获到一个变量中,因为每次选择它都会改变值:

capture @@ROWCOUNT into a variable, because it will change values each time you select it:

DECLARE @Rows   int

---your query here

SELECT @Rows=@@ROWCOUNT

然后您可以根据需要将其用作@Rows

you can then use it as necessary as @Rows