Does anybody know if a session running a T-SQL script can identify its own process ID - and if it can, then how?
I'm trying to assemble a script that will list all the locks across all the databases on a given server; but I want to exclude any locks put on by the process running the script.
If anybody has any ideas, please let me know ASAP?
Regards
Dave.