How do I do this using a trigger?

2 tables A& B both with two fields.

A : Field1 varchar ,Field2 varchar
B : Field3 varchar ,Field4 datetime

upon updating TableA a new entry must be made in TableB:

Field3 of TableB must passed the new updated value of field1 in TableA.

Field4 must be timestamped now.

Please provide me with detailed syntax, ie
try it out in ISQL before posting an answer

Who is Participating?
Victor SpiridonovConnect With a Mentor Commented:
create tr_ins_a trigger
on tableA
for update
if update(field1)
insert into tableB (field3,field4)
SELECT field1,getdate()
FROM inserted
RBertoraAuthor Commented:
Looks good,
thanks dude.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.