Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Posts
    5

    Unanswered: problems with locks and automation

    Hello to everybody!
    I am a new comer in this forum and also a new user of SQLServer.
    I would like to write a transact-SQL script that will permit me, when there is any deadlock,
    - to have a list of the processes in deadlock in a ".txt" format or any other format
    - to send a message to somebody in its mail account in order to inform him of the problem
    - to kill the process which causes the deadlock

    All these automatically.
    First of all, is it possible?
    Then if it is not, can you please give me another solution?
    I am using SQLServer 2000.
    Thanks in advance.

  2. #2
    Join Date
    Dec 2002
    Posts
    29
    Yes, it's possible:

    1.
    - to have a list of the processes in deadlock in a ".txt" format or any other format
    See: sp_lock (use the help for more info)

    2.
    - to send a message to somebody in its mail account in order to inform him of the problem
    See: xp_sendmail (use the help for more info)

    3.
    - to kill the process which causes the deadlock
    See: kill (use the help for more info)

    Best regards!

  3. #3
    Join Date
    Sep 2003
    Posts
    522

    Arrow


  4. #4
    Join Date
    Oct 2003
    Posts
    5
    Thanx to all for your replies
    Botond.baika can you please send me a script example please for all those manipulations?
    Thanx.

  5. #5
    Join Date
    Dec 2002
    Posts
    29

    Talking

    I could! ...but then you'll miss the fun of learning on your own. The MSSQL help is sufficiently detailed about these SPs. Writing the code instead of you is against my beliefs about teaching people. I could give you THE fish, but then you'll never learn how TO fish.
    If you run into specifical problems that you can not solve it on your own, and neither help and neither the different posts on forums on the Internet can't help you, then ask us the question and we will answer you. But till then it's just to easy to have somebody else figure it out for you.
    If somebody else will do this for you (write the whole thing for you) it's fine with me, but I won't.

    Best regards,
    Botond BAIKA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •