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
LG LCD TV (55LH90) and bdvt11 home theatre system
IIS problem
Netscreen-25 Port Translation
how can i find all ILO boards on a network
help with robocopy syntax
my phone number would accept
How to make the index.SHTML page as default page ?
Network issue.
Javascript to update values in <div>
How to configure the network printer in the FreeBSD 8?