Third Select statement didn't read

Guru 2014-09-18 18:20:57

SQL Sentry didn't read the third select statement. Do you know the reason?

The "Result" tab, the query plan executed only the first two select statements.

Here is the entire query:

declare @factorTypeId int;
declare @benefitId int;
Declare @BenefitExternalID uniqueidentifier = '01BE05C1-503C-44E8-AE0D-D485EBE6BF69'
Declare @pdate datetime = '09/17/2014'    
 
SET NOCOUNT ON;
 
select @factorTypeId = ft.ID
from Rating.FactorType ft
where ft.Descr = 'Surcharge';
 
select @benefitId = b.ID
from Rating.Benefit b
where b.ExternalID = @pBenefitExternalID;
 
select         
    f.Name,
    f.Descr,        
    f.[Amount], 
    o.[ShortName], 
    f.[EffectiveDate], 
    f.[ExpirationDate], 
    f.[ExternalID]        
from [Rating].[Benefit] b
join [Rating].[ElementFactor] ef on ef.[BenefitID] = b.[ID]
join [Rating].[Element] e on ef.[ElementID] = e.[ID]    
join [Rating].[Factor] f on ef.[FactorID] = f.[ID]    
join [Rating].Operation o on o.[ID] = f.[OperationID]
where f.FactorTypeID = @factorTypeId
and b.ID = @benefitId
and (@pDate between f.[EffectiveDate] and isnull(f.[ExpirationDate], '12/31/9999') or f.EffectiveDate > GETDATE())
Aaron Bertrand 2014-09-18 18:31:51
This plan was generated from Plan Explorer? Did you try to derive an actual or estimated plan? From what I can tell, you had highlighted the first two SELECT queries and did not highlight the 3rd (I'm not seeing any evidence that the longer 3rd query was in place anywhere at the time of execution). Plan Explorer will only retrieve plans for the statements that are highlighted at the time of execution.
Guru 2014-09-18 19:30:41
It works now. I have restarted the SQL Sentry and place the query again and works what I expected.

Appreciated.

Thanks,
Guru