I have the following Select statement:
select CustomerID, Name,
CASE
WHEN (CONVERT(varchar(10),(ISNULL(BuyDate, '')), 110)='01-01-1900') THEN (' ')
ELSE (CONVERT(varchar(10),(ISNULL(BuyDate, '')), 110))
END as BuyDate
from Customers;
BuyDate --it's datetime field in the Customers table
ISNULLL(BuyDate, '') returns 01-01-1900 if BuyDate contains NULL.
Is there BETTER WAY to re-write the below piece of my sql sttement ???
CASE
WHEN (CONVERT(varchar(10),(ISNULL(BuyDate, '')), 110)='01-01-1900') THEN (' ')
ELSE (CONVERT(varchar(10),(ISNULL(BuyDate, '')), 110))
END as BuyDate
Thanks