declare @1DAY datetime,
@2DAY datetime,
@3DAY datetime,
@4DAY datetime,
@5DAY datetime,
@6DAY datetime,
@7DAY datetime,
@8 datetime
SELECT @1DAY = convert(char,dateadd(dd,-7,CONVERT(DATETIME, GETDATE(), 120)),111)
SELECT @2DAY = convert(char,dateadd(dd,-6,CONVERT(DATETIME, GETDATE(), 120)),111)
SELECT @3DAY = convert(char,dateadd(dd,-5,CONVERT(DATETIME, GETDATE(), 120)),111)
SELECT @4DAY = convert(char,dateadd(dd,-4,CONVERT(DATETIME, GETDATE(), 120)),111)
SELECT @5DAY = convert(char,dateadd(dd,-3,CONVERT(DATETIME, GETDATE(), 120)),111)
SELECT @6DAY = convert(char,dateadd(dd,-2,CONVERT(DATETIME, GETDATE(), 120)),111)
SELECT @7DAY = convert(char,dateadd(dd,-1,CONVERT(DATETIME, GETDATE(), 120)),111)
select @8 = CONVERT(DATETIME, GETDATE(), 120)
select @1DAY,@2DAY,@3DAY,@4DAY,@5DAY,@6DAY,@7DAY,@8
SQL 获取前七天日期
最新推荐文章于 2023-09-24 20:57:33 发布