recently, data has to be transferred from one database to another. During this period, there are many problems related to the conversion of some strings to the time type, so I can refer to my remarks as a memo.
Case when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] [1-9] [-.] [1-9] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 0 [1-9]-0 [1-9] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 0 [1-9]-[1-9] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] [1-9]-0 [1-9] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] [2, 13456789] [-.] [12] [0-9] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 0 [13456789] [-.] [12] [0-9] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] [2, 13578] [-.] 3 [01] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 0 [13578] [-.] 3 [01] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] [2, 469] [-.] 30 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 0 [469] [-.] 30 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 2 [-.] 1 [0-9] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 02 [-.] 1 [0-9] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 2 [-.] 2 [0-8] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 02 [-.] 2 [0-8] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 1 [012] [-.] [1-9] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 1 [012] [-.] 0 [1-9] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 1 [012] [-.] [12] [0-9] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 1 [02] [-.] 3 [01] 'then cast (convert (datetime, cnct_char31, 120) as varchar) when cnct_char31 like '[12] [0-9] [0-9] [0-9] [-.] 11 [-.] 30 'then cast (convert (datetime, cnct_char31, 120) as varchar) else null end
if you have any doubts or errors, you are welcome to correct and discuss them.