DECLARE @DateStart DATETIME, @DateEnd DATETIME, @Date DATETIME SELECT @Date = GETDATE()--一个月的开始SELECT @DateStart = CAST(FLOOR(CAST(@Date as Numeric(18,10))) + 1 - DAY(@Date) as DATETIME)--一个月的结束 SELECT @DateEnd=DATEADD(ms, -3, DATEADD(MM, 1, @DateStart))--------一个月的开始和结束SELECT @DateStart, @DateEnd--一天的开始SELECT @DateStart = CAST(FLOOR(CAST(@Date as Numeric(18,10))) as DATETIME)--一天的结束 SELECT @DateEnd=DATEADD(ms, -3, @DateStart + 1)--一天的开始和结算SELECT @DateStart, @DateEnd------------------------------------------------------一个月的开始SELECT @DateStart = CAST(FLOOR(CAST(@Date as Numeric(18,10))) + 1 - DAY(@Date) as DATETIME)--一年的开始SELECT @DateStart = DATEADD(M, -month(@DateStart)+1, @DateStart)--一年的最后 SELECT @DateEnd=DATEADD(ms, -3, DATEADD(YEAR, 1, @DateStart))--一年的开始和结算SELECT @DateStart, @DateEnd