Search code examples
sqlsql-serveroracle-databasedate-arithmetic

SQL Server version of Oracle's ADD_MONTHS()


In Oracle, you can use ADD_Months to add months on the fly in the sql statement. What is the MS SQL version.

Oracle Example

Select TestDate, 
       TestFrequency,
        ADD_MONTHS(TestDate, TestFrequency) AS FutureTestDate 
  FROM Tests

Source : java's website


Solution

  • Its DATEADD(MONTH, TestFrequency, TestDate) to add TestFrequency number of months to the date field TestDate.