Identifying own session''s process_id

  • 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.

  • @@SPID this will return the process id. Bung a 'and processid != @@SPID' in your where

    clause(s)

    www.sql-library.com[/url]

  • Jules

    Many thanx for that - worked a dream.

    David.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply