Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Write trigger for multiple tables

Write trigger for multiple tables

Scheduled Pinned Locked Moved Database
databasesql-serversysadminannouncement
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vishnukamath
    wrote on last edited by
    #1

    Hi I need to write trigger for more than one table i.e single trigger for multiple tables,user can not update,delete,insert on tables.If user try to modify on sql server table need to show alert. I tried with after trigger for single table , it works fine .please suggest me better way. regards, Vishnu.

    S C 2 Replies Last reply
    0
    • V vishnukamath

      Hi I need to write trigger for more than one table i.e single trigger for multiple tables,user can not update,delete,insert on tables.If user try to modify on sql server table need to show alert. I tried with after trigger for single table , it works fine .please suggest me better way. regards, Vishnu.

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #2

      As far as I know you can't but this thread has come up with a possible solution that you could use assuming the code in the trigger is the same for all tables Single Trigger on multiple tables[^] Basically the solution they are suggesting is to have the triggers call a common stored proc

      Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

      1 Reply Last reply
      0
      • V vishnukamath

        Hi I need to write trigger for more than one table i.e single trigger for multiple tables,user can not update,delete,insert on tables.If user try to modify on sql server table need to show alert. I tried with after trigger for single table , it works fine .please suggest me better way. regards, Vishnu.

        C Offline
        C Offline
        Chris Meech
        wrote on last edited by
        #3

        vishnukamath wrote:

        user can not update,delete,insert on tables.If user try to modify on sql server table need to show alert.

        Database permissions were designed specifically for what you are looking for. If you are implementing access controls using triggers, I would say that is not a good idea. :)

        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups