Displaying SQLSErver locked Records.

  • Hi,

    My table is like this:

    Empid Ename

    1 XXXXXx

    2 yyyyyy

    3 zzzzzz

    4 mmmmm

    begin Transaction

    update emp set ename='test' where empid=2

    I did not executed commit or rollback Transaction now empid 2 is locked.

    When i executed sp_lock it give some information like (RID:1:112:1) means in 112 Page 1 row number got locked .

    I want like this ,if i pass empid to a STore procedure is there any way a record has locked or not .I tried with sp_lock ,syslocks,syslocksinfo but i failed.Is there any other way to find whether a particular row has locked or not ?

  • are you using 'implicit transactions' ?

    If yes: that will issue a "begin transaction" before the first statement you perform and you'll need to commit/rollbak in the end of whatever you are doing.

    use dbcc opentran to show open transactions.

    If you still have your open connection:

    Select @@trancount

    will show if your session still has an open transaction.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

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

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