home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 17,582 of 19,505   
   Ed Murphy to Plamen Ratchev   
   Re: CASE Statement in WHERE EXISISTS Cla   
   22 Jul 09 10:44:23   
   
   From: emurphy42@socal.rr.com   
      
   Plamen Ratchev wrote:   
      
   > Two reasons:   
   >   
   > 1). You cannot use COALESCE in the FREETEXT predicate.   
   > 2). Even if you use COALESCE before the query, then when the keyword is NULL   
   and converted to empty string you will get   
   > this error: "Null or empty full-text predicate."   
      
   Both of which can be dodged:   
      
   declare @foo varchar(whatever)   
   set @foo = coalesce(@bar,'dummytext')   
   select ... where ... and (freetext(@foo) or @bar is null)   
      
   (Inexact because now I'm doing stuff from memory, but you get the   
   idea.)  The idea is to avoid repeating the large chunk of the SELECT   
   that doesn't vary, which seems worthwhile as long as it doesn't   
   reduce performance significantly (i.e. as long as SQL is smart enough   
   to check '@bar is null' first and not bother evaluating freetext unless   
   it needs to).   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca