473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

How to test for a null value in a date column

I am creating the following view

CREATE OR REPLACE VIEW AllMedics AS
SELECT * FROM Medic m, Employee e
WHERE e.EmployeeID = m.MedicID AND
e.DateFinished = NULL;

But all I get is "no rows selected". How do I test a date column to
see if it is null?

NB The DateDinished above means the date that the employee was
fired/resigned.

Any help would be greatly appriciated.

Jagdip Singh Ajimal
Jul 19 '05 #1
5 74275
Ron

"e.DateFinished = NULL" - did you try "e.DateFinished is null"

Regards,

Ron
DBA Infopower
http://www.dbainfopower.com
Standard disclaimer:
http://www.dbainfopower.com/dbaip_ad...isclaimer.html


"Jagdip Singh Ajimal" <js*****@hotmail.com> wrote in message
news:c8**************************@posting.google.c om...
I am creating the following view

CREATE OR REPLACE VIEW AllMedics AS
SELECT * FROM Medic m, Employee e
WHERE e.EmployeeID = m.MedicID AND
e.DateFinished = NULL;

But all I get is "no rows selected". How do I test a date column to
see if it is null?

NB The DateDinished above means the date that the employee was
fired/resigned.

Any help would be greatly appriciated.

Jagdip Singh Ajimal

Jul 19 '05 #2
js*****@hotmail.com (Jagdip Singh Ajimal) wrote in message news:<c8**************************@posting.google. com>...
I am creating the following view

CREATE OR REPLACE VIEW AllMedics AS
SELECT * FROM Medic m, Employee e
WHERE e.EmployeeID = m.MedicID AND
e.DateFinished = NULL;

But all I get is "no rows selected". How do I test a date column to
see if it is null?

NB The DateDinished above means the date that the employee was
fired/resigned.

Any help would be greatly appriciated.

Jagdip Singh Ajimal


e.DateFinished IS NULL;

Dave
Jul 19 '05 #3
js*****@hotmail.com (Jagdip Singh Ajimal) wrote in message news:<c8**************************@posting.google. com>...
I am creating the following view

CREATE OR REPLACE VIEW AllMedics AS
SELECT * FROM Medic m, Employee e
WHERE e.EmployeeID = m.MedicID AND
e.DateFinished = NULL;

But all I get is "no rows selected". How do I test a date column to
see if it is null?

NB The DateDinished above means the date that the employee was
fired/resigned.

Any help would be greatly appriciated.

Jagdip Singh Ajimal

Have you tried "is null" instead of "= null " or "is not null" instead of "<> null"?
Jul 19 '05 #4
Jagdip Singh Ajimal wrote:

I am creating the following view

CREATE OR REPLACE VIEW AllMedics AS
SELECT * FROM Medic m, Employee e
WHERE e.EmployeeID = m.MedicID AND
e.DateFinished = NULL;

But all I get is "no rows selected". How do I test a date column to
see if it is null?

NB The DateDinished above means the date that the employee was
fired/resigned.

Any help would be greatly appriciated.

Jagdip Singh Ajimal


Consider this: what is the definition of 'NULL' and how can anything
'equate' to that 'value'?

You want to use the 'IS NULL', not the '= NULL' construct.

(This is basic SQL - please consider reviewing your/an 'introduction to
SQL' documentation or book. Things like this are not intuitive to the
uninitiated and will lead to frustration.)
/Hans
Jul 19 '05 #5
The solution turned out to be simple. All I did was change the code to
the following:

CREATE OR REPLACE VIEW AllMedics AS
SELECT * FROM Medic m, Employee e
WHERE e.EmployeeID = m.MedicID AND
* e.DateFinished IS NULL;
js*****@hotmail.com (Jagdip Singh Ajimal) wrote in message news:<c8**************************@posting.google. com>...
I am creating the following view

CREATE OR REPLACE VIEW AllMedics AS
SELECT * FROM Medic m, Employee e
WHERE e.EmployeeID = m.MedicID AND
e.DateFinished = NULL;

But all I get is "no rows selected". How do I test a date column to
see if it is null?

NB The DateDinished above means the date that the employee was
fired/resigned.

Any help would be greatly appriciated.

Jagdip Singh Ajimal

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Bodza Bodza | last post by:
I'm having an argument with an incumbent self-taught programmer that it is OK to use null foreign keys in database design. My take is the whole point of a foreign key is that it's not supposed...
6
by: Paulb1us | last post by:
I want to set a DateTime field to Null before passing it to the DB //First I check to see if anything is in this datarow column, because sometimes we have no data. DateTime dt; if (...
1
by: Vern | last post by:
I'm using the Microsoft Enterprise Data Access block to call the stored procedure. One of the values the stored procedure returns is the stop date. When the stop date is null, the program crashes....
8
by: craigkenisston | last post by:
I have a generic function that receives a couple of datetime values to work with. They can or cannot have a value, therefore I wanted to use null. This function will call a database stored...
6
by: Dean Slindee | last post by:
I am looking for the "right" way to handle inserting and presenting null date values. Public Const c_NullDate As Date = #12:00:00 AM# If I set the value of a date variable in an SQL Server insert...
1
by: Mike | last post by:
I have a function which caculates the number of years from a certain date. The function works great if the date is not null however when the date is null I recieve a type mismatch error. The code...
1
by: billa856 | last post by:
Hi, I am trying to insert Null value in column(ShipDate) in my table.That column(ShipDate)'s type id date/time and format is short date. I am using "" to insert Null in that column(ShipDate)...
5
by: Jagdip Singh Ajimal | last post by:
I am creating the following view CREATE OR REPLACE VIEW AllMedics AS SELECT * FROM Medic m, Employee e WHERE e.EmployeeID = m.MedicID AND e.DateFinished = NULL; But all I get is "no rows...
0
by: Microsoft Newsserver | last post by:
Hi. I have a table adapter and one of the column s is a DateTime field. The underlying table allows for nulls and this is reflected in the properties for this column in the table adapter....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.