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?
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
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SELECT DATEADD(year, 1, '2009-08-30') to be exact.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
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
UPDATE table1 SET date_column = DATEADD(year,1,date_column