How does varchar compare size?

I have a field of type VARCHAR that has a time data stored in it, but I want to compare it with it because I only want to leave the largest time in the same data, because the format of the time data is such a data with spaces.

Sql
Mar.18,2021

ascii ('ok') ascii (col_name)


convert varchar type to datetime type before comparing. There are two ways to convert

CAST('2018-6-12 09:57:03' as datetime)

CONVERT(datetime, '2018-6-12 09:57:30')
Menu