Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL Query - between 2 dates where records are datetime

$
0
0

Hi,

Im looking to get a report to show records but I would like to filter between 2 dates selected. The column stores the records as DATETIME and after a Google I found that convert should work as below

SQL
CONVERT(date,scheme.ColumnA.Record_date)between'2019-01-01'AND'2019-04-22'

But the query just sits there processing. I stopped it after 2 minutes as Im sure there must be a quicker method?

If I remove the date fileter the records are returned within 45 seconds.

Thanks


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>