DECLARE @now datetime ,@LastMonth datetime DECLARE @star datetime ,@end datetime SET @now = DATEADD (dd, DATEDIFF (dd, ' 1900-1-1 ' , getDATE ()), ' 1900-1-1 ' ) -- 当前日期 SET @LastMonth = DATEADD (mm, - 1 ,@now) -- 上个月的今天 SET @star = @LastMonth - DAY (@now) + 1 -- 上月头 SET @end = DATEADD (ss, - 1 ,@star + 32 - DAY (@star + 32 - 1 )) -- 上个月尾 SELECT @star,@end