我在下面有一个存储过程:
ALTER PROCEDURE dbo.sp_DeleteRoecords
@Conditions NVARCHAR(200)
AS
BEGIN
DECLARE @Query NVARCHAR(2000)
SET @Query = 'DELETE FROM Customer Where ' + @Conditions
EXEC (@Query)
END
执行@Query
后如何获得受影响的行?
答案 0 :(得分:1)
ALTER PROCEDURE dbo.sp_DeleteRoecords
@Conditions NVARCHAR(200)
AS
BEGIN
DECLARE @Query NVARCHAR(2000)
SET @Query = 'DELETE FROM Customer Where ' + @Conditions + ';Select @@rowcount'
EXEC (@Query)
END
删除查询后添加@@ rowcount的语句。