locked
Help to write a trigger RRS feed

  • Question

  • match win/lose trigger in sql server

    Hi all,

    how to write trigger Match win\lose\draw send Email for Users


    For Example:india vs Aus match..here when user Asked to me india win\lose\draw\tie the Match Updated on send on Email.

    is it possible?? win and loss or drawn in Match send Updated Mail to User(i mean Match will be started on 4PM and Ending on 8Pm.This situation 7.59PM india win the Match i.e.,automatic updated on user Email or mobile..how????????

    pls suggest me on send Email????????????????


    chintu

    • Split by Naomi N Tuesday, April 17, 2012 10:39 AM New unrelated question
    Tuesday, April 17, 2012 10:15 AM

Answers

All replies

  • in that case as  per my understanding you should create a procedure to send email and text on criteria basis and schduled a JOB when you want to sent the email or msg.
    Tuesday, April 17, 2012 10:43 AM
  • yes..but every time how  can i run the job???...see for example here scenario ind vs aus ..next match ind vs pakistan so..times diffenet and win or loss .....i think is not possible??/..pls suggest me....

    chintu

    Tuesday, April 17, 2012 11:41 AM
  • job can be sechduled at your specfic time, like you want the job to be run on 4 PM and 8 PM ... this can be done by SQL JOb Agent.
    Wednesday, April 18, 2012 5:53 AM
  • Create a update  trigger on the match result column and Check the value of match rusult column should be in (win,lose,draw,tie) and based on result you can write a procedure to send email.

    SQLCommitted.com

    • Edited by Sandip Pani Wednesday, April 18, 2012 6:52 AM
    • Proposed as answer by Sandip Pani Thursday, April 19, 2012 10:31 AM
    Wednesday, April 18, 2012 6:51 AM
  • Trigger is one solution and stored procedure is another.

    SP can be called by the program which updates the game results. Alternatively, SP can be scheduled as a job to run as frequently as a few minutes or once a day.

    Stored procedure is the preferred solution. If it does not meet the requirements, use trigger.

    UPDATE trigger:

    http://www.sqlusa.com/bestpractices2005/timestamptrigger/


    Kalman Toth SQL SERVER & BI TRAINING

    • Proposed as answer by Naomi N Thursday, April 19, 2012 12:56 AM
    • Marked as answer by KJian_ Monday, April 23, 2012 7:04 AM
    Wednesday, April 18, 2012 8:46 AM