balachandar
Programmer
Hi,
I would like to select the records from a table based on A field say workingdate (datetime).I need to fetch records either for a particular date,or for a date range and so on. For a particular date record selection I used
select *
from table
where
cast(working_date as char(11))=cast(getdate() as char(11))
this works fine. But as the data grows, the search is inefficient and it slows down the application drastically.then i tried the following code
select *
from table
where
working_date between '20010521 00:00:00.000' and
'20010521 23:59:59.997'
with whatever testing done till now, the code gives the correct results.can you
Please weather this will be reliable always
or Please suggest a method to select records based on date in an efficient way (the table has almost 2.7 lakh records.)
I would like to select the records from a table based on A field say workingdate (datetime).I need to fetch records either for a particular date,or for a date range and so on. For a particular date record selection I used
select *
from table
where
cast(working_date as char(11))=cast(getdate() as char(11))
this works fine. But as the data grows, the search is inefficient and it slows down the application drastically.then i tried the following code
select *
from table
where
working_date between '20010521 00:00:00.000' and
'20010521 23:59:59.997'
with whatever testing done till now, the code gives the correct results.can you
Please weather this will be reliable always
or Please suggest a method to select records based on date in an efficient way (the table has almost 2.7 lakh records.)