Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
archana23
Yak Posting Veteran
89 Posts |
Posted - 2014-11-13 : 10:17:34
|
Hi,I have table called AbsData with one field called Servicedate which is Datetime filed.. like date is stored as 2014-11-12 10:03:00.000 etc..When I trying to retrieve data from that table using below query I am not getting any dataselect * from AbsData where Servicedate = '2014-11-12'Even I usedselect * from AbsData where Servicedate = 2014-11-12 00:00:00.000'select * from AbsData where Servicedate = 2014-11-12 00:00:00'none of this query is worked.. Can you tell me how to get all the data from table where date is equal to 11/12/2014Thank you..Archana |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-11-13 : 10:28:40
|
try:select * from AbsData where cast(Servicedate as date) = '2014-11-12' -- if servicedate is NOT indexed orselect * from AbsData where Servicedate >= '2014-11-12' and Servicedate < '2014-11-13' -- if Servicedate is indexed |
|
|
|
|
|