I have a table in the SQL server that has a date field that has been datored. I am trying to get all the records in the table which is between a specified date range. Currently I am using the following SQL
SELECT SELECT WHERE dated @tartdate and @EndDate DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate = '2010-01-01 '
SET @EndDate =' 2010-06-18 12:59:59 PM '
I have an index on the Date_Printed column. I was thinking that this is the best way to get the rows in the table, which is between those dates or if there is a fast way in this table right now about it 750,000 Cord and will continue to grow it. The question is very fast, but if possible, I want to do it fast.
I would recommend that you use:
DECLARE @StartDate DATETIME DECLARE @EndDate DATETIME SET @StartDate = '2010-01-01' SET @EndDate = '2010-06-19' Select [someColumn]. .. from the table WHERE Date_Printed & gt; = @StartDate and Date_Printed & lt; @EndDate
Do not know if the last second of that day can come!
Comments
Post a Comment