Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every one



i have query like

SQL
select * from GpsData where DATE>convert(date,'23/02/2013') and UNITID='amc007'


it running fine

but

i want to get all details i wrote like this


SQL
select * from GpsData where DATE>convert(date,'23/02/2013')


but it showing error like

Conversion failed when converting date and/or time from character string.



Much appreciated your help!!
Posted
Updated 23-Feb-13 20:25pm
v2

What is the difference between the two queries apart from UNITID='amc007'
in the first query? If you have not changed the structure in the target table I don't understand why you should have an error.
 
Share this answer
 
Comments
lokesh lokesh 24-Feb-13 3:06am    
thats the error i also dont know how to solve
please any solution
when converting date format must be
YYYY-MM-dd
SQL
select * from GpsData where DATE>convert(date,'2013/02/23')

Happy Coding!
:)
 
Share this answer
 
If you really are using a constant literal date rather than a variable date, use the following syntax. With this syntax (yyyy-mm-dd), you don't have to convert the date format.

Select * from GpsData Where DATE>'2013-02-23'
 
Share this answer
 
Try this,
SQL
SELECT *
FROM   GpsData
WHERE  DATE > CONVERT(DATE, '23/02/2013', 103)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900