• Thank you for your code. It was very helpful.

    By the way... I`m looking for a code to view recent T-SQL that was executed. Just like SQL Profiler but I want to incorporate it in my application. Do you know how to do that or where can I find further help ?

    Thanks !

    Doron.