Home >> FAQs/Tutorials >> SQL Server FAQ

SQL Server FAQ - NULL Values Involved in Datetime Operations

By: FYIcenter.com

(Continued from previous topic...)

What Happens If NULL Values Are Involved in Datetime Operations?

If NULL values are involved in datetime operations, the result will be datetime NULL values. The following tutorial script shows you some good examples:

USE FyiCenterData;
GO

SELECT GETDATE()+NULL;
GO
-----------
NULL

SELECT DATEDIFF(DAY, GETDATE(), NULL);
GO
-----------
NULL

(Continued on next topic...)

  1. What Are NULL Values?
  2. How To Assign NULL Values to Variables or Columns?
  3. What Happens If NULL Values Are Involved in Arithmetic Operations?
  4. What Happens If NULL Values Are Involved in String Operations?
  5. What Happens If NULL Values Are Involved in Datetime Operations?
  6. What Happens If NULL Values Are Involved in Bitwise Operations?
  7. What Happens If NULL Values Are Involved in Comparison Operations?
  8. What Happens If NULL Values Are Involved in Boolean Operations?
  9. How To Test NULL Values Properly?
  10. How To Replace NULL Values in Expressions using ISNULL()?
  11. How To Replace Given Values with NULL using NULLIF()?

Related Articles:

More...


Other Tutorials/FAQs:

More...


Related Resources:

More...


Selected Jobs:

More...