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. Web Development
  3. ASP.NET
  4. Database Auditing ( Urgent )

Database Auditing ( Urgent )

Scheduled Pinned Locked Moved ASP.NET
databasecsharpasp-nethelpannouncement
4 Posts 2 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.
  • R Offline
    R Offline
    Roro Adel
    wrote on last edited by
    #1

    Dear all, I have the following case: In a SQL db, each time a row is changed in a specific table ( say OriginalTable ) i need to insert a row for each changed column in a specific table say ( HistoryTable ) by the following values: 1- The OriginalTable Column name ( i.e. the column that its value is changed ) 2- The Old value ( existing before the update process ) 3- The New value ( existing after the update process ) I dont know if this can be done using SQL or programmatically from the code. Plz, if anyone know the solution of that problem using any SQL or Code reply me as soon as possible. ( Note : my application is an ASP.Net c# project) thank u all Rania Adel

    M 1 Reply Last reply
    0
    • R Roro Adel

      Dear all, I have the following case: In a SQL db, each time a row is changed in a specific table ( say OriginalTable ) i need to insert a row for each changed column in a specific table say ( HistoryTable ) by the following values: 1- The OriginalTable Column name ( i.e. the column that its value is changed ) 2- The Old value ( existing before the update process ) 3- The New value ( existing after the update process ) I dont know if this can be done using SQL or programmatically from the code. Plz, if anyone know the solution of that problem using any SQL or Code reply me as soon as possible. ( Note : my application is an ASP.Net c# project) thank u all Rania Adel

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi Rania. If your RDBMS supports triggers, I think you would want a trigger for this sort of thing. What's your brand of database?

      R 1 Reply Last reply
      0
      • M Mike Ellison

        Hi Rania. If your RDBMS supports triggers, I think you would want a trigger for this sort of thing. What's your brand of database?

        R Offline
        R Offline
        Roro Adel
        wrote on last edited by
        #3

        Hi Mike, yes it support triggers, and there is already a trigger that perform the task i need, but its very very very slow, and i am responsible of doing it programatically or to enhance the trigger Thank u Rania Adel

        M 1 Reply Last reply
        0
        • R Roro Adel

          Hi Mike, yes it support triggers, and there is already a trigger that perform the task i need, but its very very very slow, and i am responsible of doing it programatically or to enhance the trigger Thank u Rania Adel

          M Offline
          M Offline
          Mike Ellison
          wrote on last edited by
          #4

          Hi Rania. Well, I think using a trigger is going to be your best bet for performance, over, say, additional C# code that would execute a separate command that the DB has to process anyway. Is your trigger doing other things besides the insert into your history table that would slow it down? Is the history table indexed? huge too? Is it possible the slowness is coming from having to refresh indexes on each insert to the history table?

          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