create trigger for insert (SQL Server)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mse07
    New Member
    • Jan 2007
    • 36

    create trigger for insert (SQL Server)

    hi

    i need to create trigger when insert records in table

    for example

    when insert records in table then run exe program.

    or if any records insert in table i need alert that is record inserting in table.

    i hope that is clear.

    thank you.
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by mse07
    hi

    i need to create trigger when insert records in table

    for example

    when insert records in table then run exe program.

    or if any records insert in table i need alert that is record inserting in table.

    i hope that is clear.

    thank you.

    What kind of alert?

    Here's the complete complete syntax.

    -- CK

    Comment

    • mse07
      New Member
      • Jan 2007
      • 36

      #3
      Originally posted by ck9663
      What kind of alert?

      Here's the complete complete syntax.

      -- CK
      it is like log file indicate that some records inserted into table or run exe program i choosed.

      thank you

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        How does your user run an EXE program from sql server?

        -- CK

        Comment

        • mse07
          New Member
          • Jan 2007
          • 36

          #5
          Originally posted by ck9663
          How does your user run an EXE program from sql server?

          -- CK
          i think using schedule task

          Comment

          • ck9663
            Recognized Expert Specialist
            • Jun 2007
            • 2878

            #6
            1. Create a table that will you can use as audit log.
            2. Create a trigger on your tables. Insert into your AuditLogTable for insert on whatever table you want created.

            On the EXE part, am not sure if a database trigger can handle this. If not, you might need to modify the task they are running to insert something on your AuditLogTable before running the EXE.

            -- CK

            Comment

            Working...