----创建存储过程 create proc spTest as .... declare @count int ----执行SQL操作 select * from table where ..../update table set ...../delete from table where ... ----保存SQL操作所涉及的行 set @count = @@rowcount .... ----返回行数 return @count GO ----接收返回值 declare @rows int exec @rows = spTest
select @@rowcount
create proc spTest
as
....
declare @count int
----执行SQL操作
select * from table where ..../update table set ...../delete from table where ...
----保存SQL操作所涉及的行
set @count = @@rowcount
....
----返回行数
return @count
GO
----接收返回值
declare @rows int
exec @rows = spTest