DECLARE @startDate1 DATE;
DECLARE @startDate DATETIME;
SET @startDate1=GETDATE();SELECT @startDate=DATEADD(DAY,-1,@startDate1);
DECLARE @endDate DATETIME ;SET @endDate=DATEADD(second,-1,CONVERT(DATETIME,@startDate1));
SELECT @startDate startDate,@endDate endDate;
DECLARE @startDate DATETIME;
SET @startDate1=GETDATE();SELECT @startDate=DATEADD(DAY,-1,@startDate1);
DECLARE @endDate DATETIME ;SET @endDate=DATEADD(second,-1,CONVERT(DATETIME,@startDate1));
SELECT @startDate startDate,@endDate endDate;
startDate endDate
----------------------- -----------------------
2014-05-19 00:00:00.000 2014-05-19 23:59:59.000