i have the following query.Both vdate and vtime are varchar fields in table.
select (isnull(RTRIM(LTRIM(CONVERT(varchar,convert(datetime,vdate,103),103))),'')+' '+ isnull(REPLACE(REPLACE(RIGHT('0'+LTRIM(RIGHT(CONVERT(varchar,convert(datetime,vtime,103),100),7)),7),'AM',' AM'),'PM',' PM'),''))
as vdate from table1
which displays vdate column in "08/04/2013 03:00 AM" format
when i sort records in asc/desc order it sorts records according to date only and not the time.I need to sort them according to both date and time.How can i do this?
Plz Help..