How to check date is not dbnull

Hi,
I have a table with field type:datetime...
i retrieve its value from database
now if the date is null the value returned from database contains time and no date...if i check against
dbnull function it returns true even if the date is null as the field format is date and the value contains time ...how do i check for null date.


Regards.
anusdesaiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ashish PatelCommented:
very simple while fetching the datetime column name, covert that column to have just date and not time like below

select convert(datetime, COLUMNNAME, 101) from TABLENAME and check with either dbNull or "" (blank)
0
ee_rleeCommented:
use isnull(mydate)
0
Ashish PatelCommented:
sorry try using this

select convert(varchar(10), COLUMNNAME, 101) FROM TABLENAME
0
anusdesaiAuthor Commented:
Hi asvforce,
Cant change the query....can i check on the result
0
Ashish PatelCommented:
Yes by using the Format function on the resulting field you can do that, just try fetching "m/dd/yyyy" and if its blank or "1/1/1900" that means there is no date.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.