SQL DateAdd Function

This article is to explain how to use the dateadd function in SQL. The Function requires three arguments in order separated by commas:

  1. Interval – This will always be either a DAY, MONTH, or YEAR
  2. Increment – This is the positive or negative integer you want the date to be adjusted by 
  3. Expression Smalldatetime – This is the value that you want changed. It can either be a column who’s data type is smalldatetime or a manually imputed date

In the example below I am updating the EndDate column in the DateTable to be three months after the date in the BeginDate column. 

update T

set EndDate = DATEADD(MONTH,3,BeginDate)

from DateTable T

Was this article helpful?
Thank you for your feedback!
User Icon

Thank you! Your comment has been submitted for approval.