Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi!
i am using datetime in whereClause but the problem is that it is not displaying any results. here is the query
select * from Comments where SendTime='4/2/2011 11:57:25 PM'
wher sendTime is the field of datatype datetime
and an other query which is also not working is
select * from Comments c,Rating r where c.SendTime=r.SendTime
Posted

1 solution

No, it won't work: SQL uses ISO format dates[^]: "yyyy-MM-dd hh:mm:ss" in 24 hour format, so your match string will always fail.
Either convert your match string to ISO format, or use a DateTime variable instead.
 
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