Click here to Skip to main content
13,347,998 members (63,036 online)
Rate this:
 
Please Sign up or sign in to vote.
i have an MS SQL Server Express edition, and i want to know if there were new products encoded in my application thru my database, or if user encoded new employees or change employee information. i want those changes stored in another table so i can easily see what are those and from which tables.

What I have tried:

i was thinking of creating a trigger for this but that would require me to add triggers to each tables. if there's a trigger for the changes in database?
Posted 7-Aug-16 21:24pm
Updated 8-Aug-16 20:49pm
Comments
Orcun Iyigun 8-Aug-16 2:46am
   
You might consider looking up 3 SQL Server auditing features (Change Tracking, Change Data Capture and SQL Server Auditing)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi JOVY,

Please follow this lin explained about trigger for insert,update,delete in tables and you can find the sample table and script also.
Trigger-Insert,Update,Delete in tables


Thanks
:)
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

SELECT 
      [db_name] = d.name
    , [table_name] = SCHEMA_NAME(o.[schema_id]) + '.' + o.name
    , s.last_user_update
FROM sys.dm_db_index_usage_stats s
JOIN sys.databases d ON s.database_id = d.database_id
JOIN sys.objects o ON s.[object_id] = o.[object_id]
WHERE o.[type] = 'U'
    AND s.last_user_update IS NOT NULL
    AND s.last_user_update BETWEEN DATEADD(wk, -1, GETDATE()) AND GETDATE()
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web04 | 2.8.180111.1 | Last Updated 9 Aug 2016
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100