Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hello Sir , How can i return balank space if date is null .I am trying this :-select isnull(date,'') as date from tablename .This query return 01/01/01 if date is null Please help me out sir .Yaman
Kristen
Test
22859 Posts
Posted - 2010-02-08 : 12:33:07
Well you can't really (because a DATETIME datatype can only store valid dates, or NULL, it cannot store "Blank"). It would be better to format the data in the application for this need.You could convert the date to VARCHAR and format it, and then provide a blank date when the date is NULL, but as I said it would be much better to do this in the application.
thats because isnull makes return type as datetime so '' will returned as default date value which is 01/01/01.for returning blank you might need to convert date to varchar. but question is why you want to do that? Isnt it enough to do this as front end?