Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change the year modified for a group of data in a reporting database 1

Status
Not open for further replies.

Jcfx

MIS
Oct 8, 2004
134
US
I have a database I use for reporting demonstration purposes. It currently has one full complete year of data (2011) and two partial years of data (2010 and 2009)

I would like to change the dates, based on a particular field called modified which is in the following format 2011-12-04 15:00:00 to the next year. So my 2009 data to 2010, my 2010 data to 2011 and my 2011 data to 2012.

The idea is to keep the data dates current in order to use for demo's, without have to create new data every year.

what would be the best process to update/change the modified years?

Thank you,
J

Julie
CRXI CE10 / RS2005 Sql DB
 
I would just use,
Code:
UPDATE YourTableNameHere SET [Modified] = DATEADD(year,1,[Modified])

(written off the top of my head, not tested, but I'm pretty sure that syntax is correct :) )

Katie
 
Oh, small self-correction, sorry:
Code:
UPDATE YourTableNameHere SET [Modified] = DATEADD(year,1,[Modified]) WHERE [Modified] IS NOT NULL

Katie
 
Thank you! Here is a star

Julie
SSRS & CR2011 / RS2008 Sql DB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top