Is there a way to see what tables and/or rows were affected in an UPDATE
in MS SQL Server 2005?
I have a sample UPDATE that should only be updating one row on one table:
update o
set o.actStatus = 'completed',
o.completed = 1,
o.completedDate = dbo.datetongdate(getdate()),
o.completedTime = ltrim(right(CONVERT(varchar, getdate(), 100),7))
from order_ o
where o.encounterID = '20724584-8C98-4599-B742-5EACC48792E7'
and o.actCode = (select top 1 test_code_id from lab_order_tests where
order_num = '160C14E2-D0DB-4275-A6D1-B0C2E726C85A')
But when I execute it in SQL Server Management Studio the message box
indicates that many rows have been affected:
(1 row(s) affected)
(15 row(s) affected)
(0 row(s) affected)
(0 row(s) affected)
(23 row(s) affected)
(21 row(s) affected)
(96 row(s) affected)
(5 row(s) affected)
(1 row(s) affected)
(15 row(s) affected)
(0 row(s) affected)
(0 row(s) affected)
(1 row(s) affected)
(14 row(s) affected)
(0 row(s) affected)
(0 row(s) affected)
(0 row(s) affected)
(0 row(s) affected)
(0 row(s) affected)
(1 row(s) affected)
(0 row(s) affected)
(0 row(s) affected)
(0 row(s) affected)
(15 row(s) affected)
(1 row(s) affected)
(15 row(s) affected)
(0 row(s) affected)
(15 row(s) affected)
(0 row(s) affected)
(5 row(s) affected)
(15 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
There are multiple triggers on that table, one of which I've built, but
four I didn't - and they would take a while to analyze. So is there are
way I can execute the statement and have it return what tables (maybe even
rows) were affected?
EDIT: I should add that I ruled out profiler because our DB server sees a
lot of traffic. It could still be an option, but I think it would be
difficult to identify what SQL originated from this update.
No comments:
Post a Comment