Hi, I have the following select statement, on some occassions it executes fine and outputs 2164 records. However, in other occassions it times out. What could be the problem. All databases are on the same server and hardly no one uses the server. Please help!SELECT DISTINCT TOP (100) PERCENT t1.o_pat_id AS vision_patid, t1.o_pat_birth_yr AS BirthYear, t1.o_pat_curr_gender AS Sex, t2.prac_no, t2.prac_eid, t2.main_doctor, t2.practice_name, t2.address1, t2.address2, t2.address3, t2.town, t2.county, t2.post_code, dbo.tblProjectPatients.LoadRef, dbo.tblProjectPatients.ProjectID, dbo.tblProjectPatients.EventDt AS Event_date, dbo.tblProjectPatients.FinalEventDt, dbo.tblProjectPatients.pat_eid, dbo.tblProjectPatients.PatCategoryFROM GPRDTech.gprdsql.TblPracDetails AS t2 INNER JOIN ODSData5.dbo.o_pat AS t1 ON t2.prac_eid = t1.o_prac_uid INNER JOIN dbo.tblProjectPatients ON t1.o_pat_eid = dbo.tblProjectPatients.pat_eidORDER BY dbo.tblProjectPatients.LoadRef
Thanks