views:

16

answers:

0

Hi, I want to list down the queries executed before the 'AFTER UPDATE TRIGGER' triggered upto n levels. The listing will be done within the TRIGGER itself. The n can be 4 or less.

Any pointer or if listing can be done by any other way will be helpful?

I have to debug the frontend and backend if bug is there.

--Edit--

Accually a cell is being update each time as empty. I have to track it down. It happens very rarely.

--Edit--

Or say how to get the last n queries executed by the user.

--Edit-- I did as follows:

SELECT top(15) dest.text AS [Query]
        FROM sys.dm_exec_query_stats AS deqs
        CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
          --inner join  sys.sysprocesses
          -- on sys.sysprocesses.sql_handle=deqs.sql_handle
        ORDER BY deqs.last_execution_time DESC

The code after -- seems to be working where as the full code gives the all users code executed queries. I comented them because It is heavy for the server.

The connecting Question is here http://stackoverflow.com/questions/3904990/sql-cell-wise-trigger

(Which is the flow comes before the issue posted as ' .. triggered, upto n levels?')

Thanks in advance.