插入半小时的中间表

DECLARE @Count INT
SELECT @Count= COUNT(1) FROM DZ_TEMP.dbo.Temp_Five_Time_Interval_Source
BEGIN
IF @Count>0
TRUNCATE TABLE DZ_TEMP.dbo.Temp_Five_Time_Interval_Source
END


--插入数据
DECLARE @dayBegin datetime,@dayEnd datetime
set @dayBegin = '2020-07-25 00:00'
set @dayEnd = '2020-07-25 23:59'
while @dayBegin <=@dayEnd
begin
insert INTO DZ_TEMP.dbo.Temp_Five_Time_Interval_Source
select @dayBegin dayBegin ,dateadd(mi,30,@dayBegin) dayEnd --每30分钟一个间隔
SET @dayBegin=dateadd(mi,30,@dayBegin)
END

上一篇:通过Alibaba Cloud Toolkit在IDE中查看SLS日志


下一篇:阿里云态势感知 - 查看内置报表