Link to home
Start Free TrialLog in
Avatar of akiles99
akiles99Flag for India

asked on

Trigger on mssql

Hi guys,
suppose i have a column name udate..

1/7/2008 12:00:00 AM
3/29/2008 12:00:00 AM
6/10/2008 12:00:00 AM
4/11/2008 12:00:00 AM

I want to find the Year to Date for the current year....

If a set of sales occured before 1/1/2008, then it would not be part of this year to date sales.....
so for all sales(another column in same table) done between 1/1/2008 and 31/12/2008 i need a total?
then the  data would move to the field in another table (field anme: ULYRSALES )
 when the System date turned past 1/1/2009 etc using trigger........

Also triggers this to increment up by 1 day evry day that lapse past the last sale date

Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of akiles99


Hi ,

It  means i want to say that it should do a sum  for the every year(eg:2008,2007,2006...)that i syearly sale ok...Also when a insert or update happen there i need a trigger(nested) that counts the days from inserted...I mean a count of o and keeps on incrementing when it is added(ondate-last sales activity)...
After a year if 31/12/2008 comes the next day the value in uytd must move on to another column namely
ULYRSALES...Please help me ...any doubts please post a message for me...