Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

smallDateTime Null Value Problem

Status
Not open for further replies.

smichener

Technical User
Sep 24, 2001
25
US
Hello All,

I'm trying to run a query in Query Analyzer in which if a smalldatetime field isNull, I want ot to come back blank. Bu when I use - ISNULL(a.terminationDate, '') - all null values are returned as 1900-01-01 00:00:00. Does anyone know how to deal with this?

Thank You

Steve
 
You'd have to convert the date to a string in order to return an empty string for the nulls, like this:

Code:
ISNULL(CONVERT(VARCHAR(20),A.TerminationDate,20),'')

-dave
 
DATETIME and SMALLDATETIME have a 'built-in' default. There isn't ever a NULL entry for those data types.

-SQLBill
 
Thank you very much Vidru, it worked like a charm.

Steve
 
Well, how come I can specify 'Null' in my table design ?

When I insert records, I clearly have nulls in the date fields.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top