p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

sql_language thread: Optimiser Hints: 'OPTION (FAST n)'


Message #1 by "Ged Read" <ged.read@i...> on Thu, 14 Dec 2000 15:18:42 +0100
The OPTION clause must be specified with the outermost
query of the statement.

--- Ged Read <ged.read@i...> wrote:
> 
> Hi,
> 
> 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
> exist'
> 
> 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'?
> 
> Ged
> 
> 
> 

---
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

  Return to Index