1

我有一个带有以下主体的存储过程:

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

4

1 回答 1

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 语句。

于 2015-05-25T06:03:21.213 回答