tsql update statement to amend year in datetime field

I have a table with startdate and enddate of type date time

How can I do a t-sql update statement to amend the year part in the datetime field
Currently all datetime fields are in 2008
2008-07-20 00:00:00.000

However I want the year to change to 2010 so it would look like

2010-07-20 00:00:00.000

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Update table xtable
set datecolumn = dateadd(Year, 2, datecolumn )
mugseyAuthor Commented:
Ok thanks can u amend so it just updates row that only have a year of 2008?  So to ignore say 2007
UPDATE yourtable
SET col = DATEADD(year, 2, col)
WHERE YEAR(col) = 2008;
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Update table xtable
set datecolumn = dateadd(Year, 2, datecolumn ) where year(datecolumn)=2008
Actually, using the function year is not the best approach if you have lots of records in your table since it will not take advantage of the indexes. The best way to take advantage of the indexes is doing something like this
Update table xtable
set datecolumn = dateadd(Year, 2, datecolumn ) where datecolumn >= '2008-01-01' and datecolumn < '2009-01-01'

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Try this:
Update Orders
Set OrderDate = DateAdd(yy,2,OrderDate)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.