Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 DATETIME Add a year

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-26 : 09:19:04
Janie writes "I have thousands of rows that contain years of 2002 that I need to change to 2003, how do I do that? I've tried several different ways and it's not working. Thanks,
03/02/2002 needs to be changed to 03/02/2003"

Nazim
A custom title

1408 Posts

Posted - 2002-03-26 : 09:24:43
Check for DateADD function in BOL.

--------------------------------------------------------------
Go to Top of Page

jackstow
Posting Yak Master

160 Posts

Posted - 2002-03-26 : 09:29:09
Try

UPDATE DateTable
SET DateColumn =
DATEADD(year,1,DateColumn)

Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2002-03-26 : 10:08:39
Note that when 29th Feb is mapped into a non-leap year, it goes to 28th Feb. This may or may not be what you want.


Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-03-26 : 11:33:32
You've piqued my curiousity ... when would you ever not want that?

quote:

Note that when 29th Feb is mapped into a non-leap year, it goes to 28th Feb. This may or may not be what you want.



setBasedIsTheTruepath
<O>
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2002-03-26 : 11:45:39
Um. Don't know sir. Seemed like a good thing to say at the time.


Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-03-26 : 13:01:43
when you want it to be the day 1 day after feb 28?

Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-03-26 : 13:44:32


setBasedIsTheTruepath
<O>
Go to Top of Page
   

- Advertisement -