Working with null dates

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
JORGEMAL
Posts: 165
Joined: Thu 03 Jul 2008 23:55

Working with null dates

Post by JORGEMAL » Thu 17 Mar 2011 23:24

I have a table with a date field which can be null, such a table now has rows with valid date values and null values too. I need to build a query in C# to get all rows that have null values in the date field but I have not been able to achieve it. It is something like this:

strQuery = "SELECT * FROM sources WHERE src_date = NULL ORDER BY src_name"

I have tried using PgSqlTimeStamp.Null without success.
What is the correct way to write this query statement?

With respect,
Jorge Maldonado

Shalex
Devart Team
Posts: 8032
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 18 Mar 2011 08:55

Please use the following query:
"SELECT * FROM sources WHERE src_date IS NULL ORDER BY src_name" .

JORGEMAL
Posts: 165
Joined: Thu 03 Jul 2008 23:55

Post by JORGEMAL » Fri 18 Mar 2011 14:48

I appreciate your answer.
So, would PgSqlTimeStamp.Null be useful to set a NULL value to a date field?

Regards,
Jorge Maldonado

Shalex
Devart Team
Posts: 8032
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 18 Mar 2011 14:56

We will investigate the possibility of using PgSqlTimeStamp.Null in this case and post here about the results.

Shalex
Devart Team
Posts: 8032
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 21 Mar 2011 13:50

By default, PostgreSQL does not allow using the NULL parameter (the expression = NULL clause). Please refer to http://www.postgresql.org/docs/current/ ... rison.html.

Post Reply