Solved

Adjust Date in Field

Posted on 2009-07-02
2
167 Views
Last Modified: 2012-05-07
I have a table myTable.  It has a field myDateField.  There are thousands of records in the table.

I need a query that will update the year portion of the dates in myDateField by adding 4 years.  For example, if the value is 6/1/2005, I need to update it to 6/1/2009.
0
Comment
Question by:wsturdev
2 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 24764515
update urtable
Set myDateField = DATEADD(year, 4, myDateField)
WHERE myDateField is not null
0
 
LVL 1

Author Closing Comment

by:wsturdev
ID: 31599238
Perfect!  Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Query Syntax Error 9 47
SQl Server 2008 R2 - Case When Null still equals NULL 10 27
the whoisactive update 12 38
Alter an update query which rounds 7 29
Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now