Last active
January 11, 2017 14:08
-
-
Save ramons03/facb1a37aa30a5206096104ae724a6f9 to your computer and use it in GitHub Desktop.
Change Year only to a date column in SQL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--SQL Server | |
UPDATE table SET DateToModify = DATEADD(YEAR, -1, DateToModify) | |
where YEAR(DateToModify) = 2015 | |
--MySQL | |
UPDATE table SET DateToModify = DATE_ADD(DateToModify, INTERVAL 1 YEAR) | |
where YEAR(DateToModify) = 2015 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment