I have a table which contains \'NULL\' values which are of type \'Datetime\'. Now i have to convert those into empty string but when when i use convert function
declare @mydatetime datetime
set @mydatetime = GETDATE() -- comment out for null value
--set @mydatetime = GETDATE()
select
case when @mydatetime IS NULL THEN ''
else convert(varchar(20),@mydatetime,120)
end as converted_date
In this query, I worked out the result came from current date of the day.