我在sql Server 2008数据库中创建一个存储过程。我想返回受影响的行数。哪个更好的选择SET NOCOUNT OFF或RETURN @@ ROWCOUNT?
ALTER PROCEDURE [dbo].[MembersActivateAccount] @MemberId uniqueidentifier AS BEGIN -- Should I use this? SET NOCOUNT OFF; UPDATE [dbo].Members SET accountActive = 1 WHERE id = @MemberId; --Or should I SET NOCOUNT ON and use the following line instead? --return @@ROWCOUNT; END
我知道这两个工作,但哪个是更好的选择,为什么?