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
the laptop is hot !
Disabling software restriction policy
PIX 515 to ASA 5505 VPN tunnel problems...
How to do SQL search with LIKE and ignore special characters?
2 factor authentication
Problem opening emails from an archiving folder in Outlook
OMA and OWA
Forest functional level issue when trying to install Exchange Server 2010
ReportViewer break pages
How to view .stp or .wsp files in Microsoft Office sharepoint designer mode