sql server - How to order by date when the column is not date formatted? -


the database i'm querying has user table column containing date user registered website.

the date entered varchar column without proper date formatting this:

apr 18 2013 12:27pm 

when select max (datecolumn) value half way across range of dates. i've considered using substrings grab year, month, date , order them in sequence. problem dates days starting 0 shortened 1 character this:

may 1 2013 12:27pm 

is there simple way find highest date, without altering database structure?

try select max(convert(datetime, datecolumn, 109))

further information on converting between datatypes in sqlserver (including date formats) here.


Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -