Use SmartConnect Select MapId, RunNumber, KeyLong, [Message] from TraceHeader h INNER JOIN TraceLine l ON h.TraceHeaderId = l.TraceHeaderId Where h.StartDate < dateadd(day,datediff(day,1,GETDATE()),0) Select * from LogEventLog Where EventDateTime < dateadd(day,datediff(day,1,GETDATE()),0) Select * from ProcessErrors