Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I check if a SQL Server datetime column is empty?

Tags:

How do I check if a SQL Server datetime column is empty?

like image 701
Vahid Avatar asked Dec 28 '10 13:12

Vahid


People also ask

How can I check if a datetime field is NULL in SQL?

Use model. myDate. HasValue. It will return true if date is not null otherwise false.

How do I check if a column is empty in SQL?

SELECT * FROM yourTableName WHERE yourSpecificColumnName IS NULL OR yourSpecificColumnName = ' '; The IS NULL constraint can be used whenever the column is empty and the symbol ( ' ') is used when there is empty value.

IS NULL datetime SQL Server?

A NULL date is NULL (no value). An empty string, on the other hand, evaluates to 0 , which in SQL Server is implicitly an integer representing the number of days since 1900-01-01 .

Where date is not null in SQL?

The IS NOT NULL condition is used in SQL to test for a non-NULL value. It returns TRUE if a non-NULL value is found, otherwise it returns FALSE. It can be used in a SELECT, INSERT, UPDATE, or DELETE statement.


1 Answers

Test it with IS NULL.

If using .NET, test against DBNULL.

like image 161
Oded Avatar answered Oct 26 '22 05:10

Oded