General discussion

  • Creator
    Topic
  • #2175297

    sql server – trigger/procedure need help

    Locked

    by neeraj.dale ·

    Hi all,

    I am a newbie of sql server programming. can anyone help me?

    1. I am having a table called sonic. whenever any
    changes insert/delete/update done in the table i
    need to export this table in a mdb file and mail
    this mdb to several locations.
    plz guide how can this be possible. by using
    trigger or stored procedure. How to export the table in mdb.

    2.there are two tables one is cns and second is route.in cns i am having fields
    from_station,to_station,enroute_1,enroute_2,enroute_3,enroute_4
    In route i am having fields
    from_station,to_station,enroute_1,enroute_2,enroute_3,enroute_4

    whenever a new record inserts enroute fields value not given these value should be update from route in cns after inserting a new record in CNS.

    for that i need to select enroute fields value on the condition from_station,to_station and update it in the cns table at the time of insertion.

    Plz guide if anyone can.

All Comments

  • Author
    Replies
    • #3322475

      I wouldn’t recomend doing that in a trigger

      by tony hopkinson ·

      In reply to sql server – trigger/procedure need help

      I’m not sure you could anyway but you’ll be adding everything the trigger does into the transaction it self, the overhead could go from silly to dangerous.

      My recomendation would be to create another table and simply flag the requirement to transfer the data.
      Then have a separate script/application/sp do the export and mailing if the flag is set.

      I’m a bit out of date on SQL Server so I don’t know if it will do an export to access and mail the resultant file, but you definitely do not want to do that much processing in a Trigger. They should be in and out things, dead quick, little room for error and be very wary of cascading them.

      P.S. questions like the should go the Technical Q & A
      Homage to Deepsand.

    • #3322403

      Wrong forum.

      by deepsand ·

      In reply to sql server – trigger/procedure need help

      This is a tech. problem, in search of a solution.

      It properly belongs in “Technical Q&A,” not in “Discussions.” Please re-post there.

      Not only will you be more likely to attract the attention of those seeking to provide answers, but you will also make it easier for those seeking discussions to find such.

      Thank you.

Viewing 1 reply thread