Correct Way to Get Date Between Dates In SQL Server
- by Chuck Haines
I have a table in SQL server which has a DATETIME field called Date_Printed. I am trying to get all records in the table which lie between a specified date range. Currently I am using the following SQL
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate = '2010-01-01'
SET @EndDate = '2010-06-18 12:59:59 PM'
SELECT * FROM…