Muhammad Tariq
Muhammad Tariq

Reputation: 71

how to get data from Msql database that is stored in string format

i have stored date in string format in the MySQL database . i have to generate monthly(0-31) report of data but query gives wrong results because date is store in string format.... any one can tell me how to solve this problem and what will be the query.

Upvotes: 0

Views: 54

Answers (2)

user4026109
user4026109

Reputation:

Sql command for convert this:

SELECT convert(datetime, 'date here').

Upvotes: 1

Revils
Revils

Reputation: 1508

then convert it to a date type and not a string type. or else parse it into an date.

First hit on google: sql string in date: http://www.sqlusa.com/bestpractices/datetimeconversion/

Upvotes: 0

Related Questions