Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Compare Datetime with Null

Author  Topic 

SQLSeeker
Starting Member

15 Posts

Posted - 2009-10-14 : 08:59:27
Hello Friends,
There is a column whose data type is DateTime which can contain NULL value. Now I want to compare this Column with Null.

Select * from testtbl where exdt(Datetime) = NULL

This query doesn't work. Suggest any other ways to achieve this.

Thanks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-14 : 09:03:26
NULL values always compare with:
WHERE Column IS NULL
or
WHERE Column IS NOT NULL


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-14 : 09:13:43
What is exdt? a function?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SQLSeeker
Starting Member

15 Posts

Posted - 2009-10-14 : 09:37:30
hi,

Column IS NULL works.

Thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-14 : 09:39:15
quote:
Originally posted by SQLSeeker

hi,

Column IS NULL works.

Thanks


Did you read my first reply?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-14 : 09:42:08
I assume that exdt is the columnname and (Datetime) was a hint for us to know that it is a datetime column.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-14 : 09:46:22
quote:
Originally posted by webfred

I assume that exdt is the columnname and (Datetime) was a hint for us to know that it is a datetime column.


No, you're never too old to Yak'n'Roll if you're too young to die.


I think you are correct

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -