The OPTION clause must be specified with the outermost
query of the statement.
--- Ged Read <ged.read@i...> wrote:
> I'm trying to add the optimise hint 'OPTION (FAST
> 1)' to a sub-query but
> keep getting syntax errors.
> e.g. SELECT TOP 1 Id FROM IgnoreIds WHERE Id = '123'
> OPTION (FAST 1)
> works fine... but
> IF NOT EXISTS (SELECT TOP 1 Id FROM IgnoreIds WHERE
> Id = '123' OPTION (FAST
> 1)) print 'not exist'
> IF '123' NOT IN (SELECT TOP 1 Id FROM IgnoreIds
> OPTION (FAST 1)) print 'not
> both fail with the syntax error:
> Server: Msg 156, Level 15, State 1, Line 1
> Incorrect syntax near the keyword 'OPTION'.
> They work fine without the 'OPTION (FAST 1)'.
> Does anyone have any ideas/work arounds for this? Is
> the optimiser smart
> enough the use 'FAST 1' by default when you specify
> 'TOP 1'?
You are currently subscribed to sql_language as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-sql_language-$subst('Recip.MemberIDChar')@p2p.wrox.com