How to Retrieve Affected Rows?

Hello,

I have a database table where upon inserting a new record, I get 1 row(s) affected twice. But when deleting the record, I only get one instance of that message. I'm not really an expert, neither have I designed the database, but how can I retrieve the actual affected rows or determine what table does the other row pertain to?

Thanks in advance

August 31st, 2015 1:07am

Hello,

I have a database table where upon inserting a new record, I get 1 row(s) affected twice. But when deleting the record, I only get one instance of that message. I'm not really an expert, neither have I designed the database, but how can I retrieve the actual affected rows or determine what table does the other row pertain to?

Thanks in advance

Looks like you have an insert trigger on your table but not for delete. you can check the trigger on this specific table by this :

select *
FROM sys.triggers 
WHERE OBJECT_NAME (parent_id) = '<your_table_name>'

to retrieve actual affected rows , you can use the OUTPUT CLAUSE :

OUTPUT

Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 1:14am

Hello Rishabh K,

Thank you for your swift reply. It turns out there is one trigger related to that table. I managed to retrieve the trigger definition and found that INSERT triggers a procedure.

Regards

August 31st, 2015 1:58am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics