View Full Version : update just year


rob b
02-24-2002, 09:17 AM
Is it possible to change just the year in a table of dates.
The year in the date field varies and I want to change them all to say 2002 without changing the day and month.
Ive tried picking certain years and then using dateadd to get the year I want but there has to be a quicker way doesn't there?
Any help would be appreciated.

Alexandre
02-24-2002, 11:59 AM
UPDATE MyTable
SET MyTable.MyDateField= DateSerial(2002,Month([MyDateField]),Day([MyDateField]));
Alex

rob b
02-25-2002, 02:41 PM
Alex
Thanks for your help it worked great.
Rob b