Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

Does anyone know how I can get the statment that fired the trigger. say i place a trigger on a table.

AFTER INSERT, UPDATE, DELETE

And once a new row is inserted so I can extract the insert statement that was fired in order to do this.

Any help would be great

Please no quickly googled answers "I already did the googling"
Posted
Comments
Mehdi Gholam 16-Aug-12 5:37am    
Why do you want the statement that fired the trigger?
L Viljoen 16-Aug-12 5:57am    
I wish to be able to log it , so that I can then take that query and parse it via a web service to a data warehouse.

I am aware that this might not work for huge datatypes but for my purposes it would be ideal, as i want to keep the data in the warehouse as upto date as possible

1 solution

Use SQL Server Profiler to track the statements that are executed.It is accessed through Microsoft SQL Server 2008 -> Performance Tools -> SQL Server Profiler
 
Share this answer
 
Comments
L Viljoen 16-Aug-12 5:28am    
sorry i should have been a bit more clear , I want to do it using a trigger so I can store the query on a table

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900