SYSDATE Function - Oracle to SQL Server Migration

Oracle SYSDATE function returns the current date and time with seconds precision. In SQL Server you can use GETDATE() function but it includes time with milliseconds precision .

Oracle:

  ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS';
 
  -- Get the current date and time
  SELECT SYSDATE FROM dual;
  # 2024-10-13 12:46:28

SQL Server:

  -- Get the current date and time with milliseconds
  SELECT GETDATE();
  # 2024-10-13 12:46:28.877

For more information, see Oracle to SQL Server Migration.