SQLTeam.com | Weblogs | Forums




I have Date Column Order_Date In varchar Format which stores value as ('14/05/2018 10:26:15'
This is format) ,
Now I Salesman Creating order dailybasis and getting into Order_date column , for a particluar day i need all those order that was crated
before 14:00 P:M

and Second Column I want to extract order after 15:00 P:M i.e Time from 15:00 P:M till 23:00 P:M in SQL SERVER,

My Order_Date is in Varchar data type


in your queries, convert the VARCHAR type to DATETIME and use that for your work. Why store it as varchar? Takes more space and offers no advantage and can introduce errors.


But Now i have alrady stored it as varchar and it has 20lakhs record in thi sformat dd/mm/yy hh:mm:ss

Now it is not converting into datetime format,,how should i convert it...


CONVERT(Datetime, left(yourcolumn,10), 104)