Change NULL values in Datetime format to empty string

前端 未结 10 1550
鱼传尺愫
鱼传尺愫 2021-01-07 16:50

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



        
10条回答
  •  长发绾君心
    2021-01-07 17:33

    using an ISNULL is the best way I found of getting round the NULL in dates :

    ISNULL(CASE WHEN CONVERT(DATE, YOURDate) = '1900-01-01' THEN '' ELSE CONVERT(CHAR(10), YOURDate, 103) END, '') AS [YOUR Date]
    

提交回复
热议问题