locks

  • How to know whether there is a lock on a table.

  • Is this a start?

    
    
    SELECTObject_Name(syob.id)
    FROMmaster.dbo.syslocks sylo WITH (NOLOCK)
    JOIN
    <DBName>.dbo.sysobjects syob WITH (NOLOCK)
    ON sylo.id = syob.id
    WHEREsyob.type = 'U'
    AND sylo.dbid = (DB_ID('<DBName>'))

    SJTerrill

  • Oops. It only works if you run it in QA from the database which you want to check for locks. If you do it from master, I end up with sp's being returned instead of tables. I wonder what I'm doing wrong?

    SJTerrill

  • sp_lock will give you the locks. Try sp_who2 for deadlocks.

    Darren


    Darren

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

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