Link to home
Start Free TrialLog in
Avatar of Vikash p
Vikash p

asked on

Help in writing trigger

Hi I have two tables.

Table1
Client_ID int Identity    (PK)

ClientName Varchar(50)
gender Bit
Address varchar(300)
Status char(1)

and a Log table

Table_History

History_ID int Identity(1,1) (PK)

User_ID   int
FieldEffected varchar
Olddata varchar
newdata varchar
timestamp datetime

can any one help me in writing trigger for Insert , Update and delete . for timebeing I can fix user_ID as '1000001'
ASKER CERTIFIED SOLUTION
Avatar of Brendt Hess
Brendt Hess
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
When you compare the old and new values, you also need to compare correctly to allow NULL value(s) to be on one side or the other or both.