SQL SERVER DATETIME FORMAT

前端 未结 6 1958
忘了有多久
忘了有多久 2020-12-05 15:52

Studying SQL Server there is something I am not sure of:

A datetime field with the value: 2012-02-26 09:34:00.000

If I select out o

6条回答
  •  天命终不由人
    2020-12-05 16:13

    case when isdate(inputdate) = 1 
    then convert(datetime, cast(inputdate,datetime2), 103)
    else
    case when isdate(inputdate) = 0 
    then convert(datetime, cast(inputdate,datetime2), 103)
    

提交回复
热议问题