Avatar of akiles99
Flag for India

asked on 

Trigger for date

Hi guys,
I need to write a trigger on mssql...The scenario is pretty simple.

I have two tables namely customer & dealer...

Customer has the following columns

ondate datetime
rectype varchar(20)

Dealer has the follwing columns
ULSTORDAGE varchar(20)

Now what i need is when i insert or update a row in table customer the trigger has to fire.

sales activity means the rectype='S'.

Trigger:To populate the field with the number of days since the last sales activity of the
contact record.
This will come from the  table (Customer) as the total number of days elapsed since their
last order or sales activity, in reverse, from today. This would be adjusted for each day going
forward and will require an automatic update each day.
Using a RecType Code of S and the ONDATE field as the evaluation field.
Update the Dealer table in column named ULSTORDAGE.

I mean ondate value difference(the date going to be inserted/updated & the previous last sales date)
has to be stored in ULSTORDAGE.

Microsoft SQL Server 2005Microsoft Excel

Avatar of undefined
Last Comment

8/22/2022 - Mon