update just year

rob b

Registered User.
Local time
Today, 14:47
Joined
Sep 28, 2000
Messages
16
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.
 
UPDATE MyTable
SET MyTable.MyDateField= DateSerial(2002,Month([MyDateField]),Day([MyDateField]));
Alex
 
Alex
Thanks for your help it worked great.
Rob b
 

Users who are viewing this thread

Back
Top Bottom