Bagaimana saya bisa mendapatkan jumlah baris yang dipengaruhi oleh permintaan UPDATE dalam Prosedur Tersimpan (SQL Server 2005), sebagai hasil. misalnya
CREATE PROCEDURE UpdateTables
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
UPDATE Table1 Set Column = 0 WHERE Column IS NULL
UPDATE Table2 Set Column = 0 WHERE Column IS NULL
UPDATE Table3 Set Column = 0 WHERE Column IS NULL
UPDATE Table4 Set Column = 0 WHERE Column IS NULL
END
Kemudian kembalikan:
Table1 Table2 Table3 Table4
32 45 0 3
sql
sql-server
SamWM
sumber
sumber
Anda mungkin perlu mengumpulkan statistik saat Anda pergi, tetapi
@@ROWCOUNT
tangkap ini:declare @Fish table ( Name varchar(32) ) insert into @Fish values ('Cod') insert into @Fish values ('Salmon') insert into @Fish values ('Butterfish') update @Fish set Name = 'LurpackFish' where Name = 'Butterfish' select @@ROWCOUNT --gives 1 update @Fish set Name = 'Dinner' select @@ROWCOUNT -- gives 3
sumber