Working with null dates

Working with null dates

Postby 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
JORGEMAL
 
Posts: 165
Joined: Thu 03 Jul 2008 23:55

Postby Shalex » Fri 18 Mar 2011 08:55

Please use the following query:
"SELECT * FROM sources WHERE src_date IS NULL ORDER BY src_name" .
Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44

Postby 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
JORGEMAL
 
Posts: 165
Joined: Thu 03 Jul 2008 23:55

Postby 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: 7774
Joined: Thu 14 Aug 2008 12:44

Postby 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/static/functions-comparison.html.
Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for PostgreSQL