August 9, 2007 at 11:41 am
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?
August 9, 2007 at 11:50 am
update dbo.TargetTable set
targetfield = dateadd(yyyy, targetfield, 1)
where
(any criteria to restrict the update)
August 9, 2007 at 12:38 pm
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)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply