Link to home
Create AccountLog in
Avatar of johnkainn
johnkainn

asked on

update 2009 to 2010

I have datetime column. I need to update the column and change the year.
2009 should become 2010
for example: 2009-08-24 00:00:00.000 should be 2010-08-24 00:00:00.000
How is best to do this?
ASKER CERTIFIED SOLUTION
Avatar of Asim Nazir
Asim Nazir
Flag of Pakistan image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SELECT DATEADD(year, 1, '2009-08-30')  to be exact.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Try this it will update all the year 2010 records with 2011. Let me know if it helped????

UPDATE table1 SET date_column = DATEADD(year,1,date_column) where YEAR (date_column) = 2010