• Thanks guys. Yes, @@SPID is what I was looking for.

    When adding columns to a table via our admin app, I need to show the admin user that the users X, Y and Z are still connected. They need to be disconnected to ensure data integrity in those tables. Normally the admin user would have told the users to exit the system, but I don't want to rely entirely on that (users can be an interesting bunch after all 🙂 .) If the admin user okays it, the admin app will disconnect the users.

    I was going to do it via a for loop in the app, merely KILLing all session ids that are not the current user's and that are connected to the target database. However, is there a better way? Over at bytes.com "Hugo Kornelis, SQL Server MVP" posted

    ALTER DATABASE <dbname> SET SINGLE_USERorALTER DATABASE <dbname> SET SINGLE_USER WITH ROLLBACK_IMMEDIATE

    but my SSMS gives me a syntax error when I execute WITH ROLLBACK_IMMEDIATE. Is there a better way that ensures that transactions get rolled back? Should I just KILL the other sessions one by one and let their transactions roll back one by one or can I get all the transactions to roll back in parallel?

    Thanks