sql query

  • date cy& cm cY&cw Py&cw cY&MONTHOFEND PY&MONTHOFEND

    2012-01-31 12:27:59.287 N N N N N

    2012-02-27 12:27:59.287 N Y N Y N

    2012-02-28 14:27:59.287 Y Y N Y N

    2011-02-28 14:27:59.287 N N Y N Y

    CY=CURRENT YEAR

    PY=PREVIOUS YEAR

    CW=CURRENT WEEK

    month of end =name of month (for e.g name of month in date column like for first row it is jan and other three it is feb whether that is same year or previous year)

    we have TABLE having various columns one has date and other current year& current month(cy&cm),previous year & current week(py&cw),cy&monthofend(current year and monthof end),previous month and month of end(py&month of end).now i want that suppose tonight at 2 am i want to execute the package .so if date column is equal to yesterday date{getdate()-1 (bcz i want to compare the date column with previous date not with the date of execution)} then update cy & cm and similarly other columns with y and n.suppose we are executing tonight @ 2 am(2/29).then if date column is equal has 28 and feb month then update yes else no

    for more explanation month of end means if date column has value like 2012-02-10 then for this it is yes bcz it has same month of end.same rule is applies py&month of end if it has same end month but in last year.

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply