Monday, March 19, 2012

Check Database Operation

Hi,
I want to check that which operation like Insert, Update or Delete is
performed on the table in a trigger written for all the these opertaions.
Is there is any function from which I can know this?
Thanks.
The only way you can tell in a trigger is the presence or absence of rows in
the inserted and deleted table:
1. No rows in either table - nothing was changed
2. Rows in inserted , none in deleted - Insert
3. Rows in deleted , non in inserted - Delete
4. Rows in both - Update
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Syed Zulfiqar" <zulfiqar_syed@.hotmail.com> wrote in message
news:uzu3YIgHEHA.548@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I want to check that which operation like Insert, Update or Delete is
> performed on the table in a trigger written for all the these opertaions.
> Is there is any function from which I can know this?
> Thanks.
>

No comments:

Post a Comment