Date field update using SQL

10 pts.
Tags:
SQL
I need to add 2 years to a date field using SQL.
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Subhendu Sen

    Have you written a query. What error is there in your query. You may come with your query and if there is any error, then it is possible to rectify the same. However for your concept, please navigate here: https://searchsqlserver.techtarget.com/tip/Using-DATEADD-and-DATEDIFF-to-calculate-SQL-Server-datetime-values

    140,720 pointsBadges:
    report
  • ToddN2000
    Sounds like a homework question. Post your code so we can see what date and let us know what format it is in. They're a lot of them like mm/dd/yy, dd/mm/yy, yy/mm/dd, julian, *iso.

    Checkout this link for more on altering dates.
    134,585 pointsBadges:
    report
  • carlosdl
    What database are you using?

    It may vary from vendor to vendor, so that is an important detail.

    In Oracle, you could do something like this:

    UPDATE your_table
    SET your_column = add_months(your_column,24)
    WHERE <your conditions>;

    85,015 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: