clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2249306 fiddles created (32229 in the last week).

Declare @time_info nvarchar(max) Declare @format_time_info nvarchar(max) Declare @time_info_final nvarchar(max) Declare @time_detail datetime SET @time_info='30/1/2020 20:34:16 6 300' Select @format_time_info = (Select REPLACE(@time_info,('/'+SUBSTRING( @time_info, CHARINDEX('/', @time_info) + 1, LEN(@time_info) - CHARINDEX('/', @time_info) - CHARINDEX('/', REVERSE(@time_info)))+'/'), (CONCAT('/',(convert(varchar,(convert(int,(SUBSTRING( @time_info, CHARINDEX('/', @time_info) + 1, LEN(@time_info) - CHARINDEX('/', @time_info) - CHARINDEX('/', REVERSE(@time_info)))+1))))),'/')))) Select @time_info_final =(Select left(@format_time_info, charindex(' ', @format_time_info, charindex(' ', @format_time_info)+1)-1)) Select @time_detail = CONVERT(datetime, @time_info_final,103)-- Cast(@time_info_final as datetime)-- Convert(datetime,Cast(@time_info_final as datetime2),210) -- SELECT @time_info_final, @time_detail
Msg 242 Level 16 State 3 Line 15 The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.
 hidden batch(es)