Adjust Date?

  • I have a table where I need to increment the year of a datetime field by one year. The rest of the date must remain the same.

    Can someone help me out?


    Regards,
    Bob Szymanski
    Blue Mule Software

  • update dbo.TargetTable set

         targetfield = dateadd(yyyy, targetfield, 1)

    where

        (any criteria to restrict the update)

  • Hi Lynn, thanks for your reply.

    I was able to get it running using the following:

    update dbo.TargetTable set

    targetfield = dateadd(yyyy, 1, targetfield )

    where

    (any criteria to restrict the update)


    Regards,
    Bob Szymanski
    Blue Mule Software

Viewing 3 posts - 1 through 2 (of 2 total)

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