Change NULL values in Datetime format to empty string

前端 未结 10 1504
鱼传尺愫
鱼传尺愫 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:28

    CASE and CAST should work:

    CASE WHEN mycol IS NULL THEN '' ELSE CONVERT(varchar(50), mycol, 121) END
    

提交回复
热议问题