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. Database Auditing (Urgent)

Database Auditing (Urgent)

Scheduled Pinned Locked Moved Database
databasecsharpasp-nethelpannouncement
2 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 project) thank u all Rania Adel

    A 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 project) thank u all Rania Adel

      A Offline
      A Offline
      Alex Deem
      wrote on last edited by
      #2

      You can use an SQL TRIGGER to create these records automatically whenever a modification is performed. (see CREATE TRIGGER in the SQL documentation). Also, you can use the COLUMNS_UPDATED() function to determine which columns have been changed (in order to produce the text for the column name). Hope this helps. Regards, Alex

      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