SQL 获取日期的该月的第一天和最后一天
DECLARE @date datetime,
@startTime datetime,
@endTime datetime
SET @startTime = DATEADD(DAY,-DAY(@date)+1,@date)
SET @endTime = DATEADD(DAY,-(DAY(DATEADD(MONTH,1,@DATE))),DATEADD(MONTH,1,@DATE))
DECLARE @date datetime,
@startTime datetime,
@endTime datetime
SET @startTime = DATEADD(DAY,-DAY(@date)+1,@date)
SET @endTime = DATEADD(DAY,-(DAY(DATEADD(MONTH,1,@DATE))),DATEADD(MONTH,1,@DATE))