declare @count int
declare @count1 int
declare @dt date
set @count=0
set @count1=0
set @dt=GETDATE()
--print @dt
--set @dt=DATEADD(dd,-1,@dt)
--print @dt
declare @imageuuid uniqueidentifier
declare @seriesUUIDTem uniqueidentifier
while (@count1<1000 or @count<1000)
begin
set @seriesUUIDTem=NULL
select top 1 @seriesUUIDTem=SeriesUUID from DicomMetaData..Series where cast(SeriesDateTime as DATE)=@dt
if exists (select top 1 imageuuid from DicomMetaData..image where SeriesUUID =@seriesUUIDTem)
begin
select top 1 @imageuuid=imageuuid from DicomMetaData..image where SeriesUUID =@seriesUUIDTem
set @count1=@count1+1
print cast(@imageuuid as varchar(36))+': '+cast(@dt as varchar(20))
end
set @dt=DATEADD(dd,-1,@dt)
set @count=@count+1
end
print @count1
print @count