• sysprocesses is a server-level view, it's not database-specific. It returns all of the sessions connected to the server and, as one of the columns, has the id of the database that the session is currently connected to.

    select * from master.sys.sysprocesses

    where spid>50 -- don't want system sessions

    and dbid = DB_ID(<name of database in question>)

    I'm using sysprocesses (a compatibility view) because I don't know how to get the DBID of a sleeping connection via the 2005 DMVs

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass