May 7, 2009 at 12:49 am
hi all,
I want to Convert a datetime into some standard format date format,
ie, 19/12/2008 12:00:00 PM ---->19-Dec-08
so i am using this function
Convert(datetime,tbl_Details.UpdateDate), 106) as date,
IF the date value is null or empty string ,this function returns default date value as 1-jan-00
i want to return empty string if the date value is null or empty.
Thanks in advance.
deesh
May 7, 2009 at 1:15 am
If the tbl_Details.UpdateDate is NULL, the result will be NULL also. If tbl_Details.UpdateDate is an empty string, the result will be 1 jan 1900.
Try: Convert(datetime,CASE WHEN tbl_Details.UpdateDate = '' THEN NULL ELSE tbl_Details.UpdateDate END, 106) as date
Perhaps it's not a good idea to use a character field for storing dates?
May 7, 2009 at 2:13 am
THANKS NOW WORKING FINE..
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply