Microsoft
Software
Hardware
Network
Question : Write a trigger which, when the salary of any employee(s) is updated, inserts a single record into this audit table with the total amount of the change across all employees.
I had to revise my question since people think it's different.
Table TBL_EMP_AUDIT is defined as follows:
create table TBL_EMP_AUDIT
(auditid int primary key identity(1,1),
notes varchar(200),
delta money)
I need to write a trigger which, when the salary of any employee(s) is updated, inserts a single record into this audit table with the total amount of the change across all employees.
e.g. if five employees were given $1000 pay cut in a single update statement, the audit table should contain one row with values delta = -5000, notes = ‘Salaries updated’
I found a similar question about it on EE but they had set amounts that the salary will be reduced or added. It has to be variable.
Thanks for all your help in advance
Answer : Write a trigger which, when the salary of any employee(s) is updated, inserts a single record into this audit table with the total amount of the change across all employees.
Depends on your definition of delta.
Normally is is current - previous, so inserted - deleted.
It looks ok otherwise.
You may want to remove @affected_rows, since it is redundant.
Random Solutions
How do I update file, save to new location and keep original file as is using Visual Basic 2008?
How to update Hyperlinks in Excel 2003?
Clients not connecting to WSUS
return double array in Delphi call to c++
Licensing Small Business Server 2008 Standard plus Microsoft Server 2008 Standard
Photoshop - picture blurring
IPSEC tunnels of Cisco ISR routers
SBS capabilities with 50 user firm
SBS 2008 move data feature crashes
I wanted to parse out text in outlook using VBA and save the values in a spread sheet