Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
SQLIsTheDevil
Posting Yak Master
177 Posts |
Posted - 2009-10-27 : 10:39:47
|
| Hello,I want to write a trigger which monitors when a row is deleted from a table, with specific conditions (i.e. where column=xx). But I want to capture what ad-hoc sql statement (from server-side code) is doing it and throw that into a separate table. Is there a way to do this?Thank you!Jeff |
|
|
SQLIsTheDevil
Posting Yak Master
177 Posts |
Posted - 2009-10-27 : 11:38:23
|
| I wrote the trigger; it's not long at all, but all the trigger does is "select * from deleted where column1=xx"This tells me what was deleted, but it doesn't tell me what the specific ad-hoc query was which was executed. Is there a way I can retrieve that? Maybe I can make use of "INSTEAD OF" somehow? |
 |
|
|
YellowBug
Aged Yak Warrior
616 Posts |
|
|
YellowBug
Aged Yak Warrior
616 Posts |
|
|
SQLIsTheDevil
Posting Yak Master
177 Posts |
Posted - 2009-10-27 : 14:08:52
|
| Thank you so much!This will be of great help. Thank you!I'm also looking for a solution in sql 2000 but I imagine I'd have to employ a similar feat to the one you described. |
 |
|
|
YellowBug
Aged Yak Warrior
616 Posts |
Posted - 2009-10-27 : 16:07:56
|
| You're welcome. Glad to help. |
 |
|
|
|
|
|