Migrating Date Functions from Oracle to SQL Server

This table shows the equivalent Microsoft® SQL Server™ function for each Oracle function.

Function Oracle SQL Server
Date addition (date column +/- value)
or ADD_MONTHS
DATEADD
Difference between dates (date column +/- value)
or MONTHS_BETWEEN
DATEDIFF
Last day of month LAST_DAY N/A
Time zone conversion NEW_TIME N/A
First weekday after date NEXT_DAY N/A
Convert date if NULL NVL ISNULL
Character string representation
of date
TO_CHAR DATENAME
Integer representation of date TO_NUMBER
(TO_CHAR))
DATEPART
Date round ROUND CONVERT
Character string to date TO_DATE CAST
Date truncate TRUNC CONVERT
Current date and time SYSDATE GETDATE()

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.