日期:2014-05-16 浏览次数:20490 次
if OBJECT_ID('tempdb..#temp') is not null
drop table #temp
select * into #temp from (
select distinct a.DataTime,b.FileName,b.SheetName,
b.SheetType,b.ReportName,b.CoreReportName,
a.DisplayName
from a,b
where a.wsObtainID=b.wsObtainID
) tg
where 1=2
declare @i int
set @i=1
while @i<14
begin
insert into #temp
select * from (
select distinct a.DataTime,b.FileName,b.SheetName,
b.SheetType,b.ReportName,b.CoreReportName,
a.DisplayName
from a,b
where a.wsObtainID=b.wsObtainID
) tg
where tg.DataTime=2000+@i
set @i=@i+1
end
select *
from #temp