Re: Optional CONTAINS

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: John Kane (jt-kane_at_comcast.net)
Date: 04/25/04

  • Next message: James Bradley: "Re: What's the deal with PAGEIOLATCH_SH?"
    Date: Sun, 25 Apr 2004 13:40:17 -0700
    
    

    Matias,
    Are you still looking for solutions other than the IF... THEN ELSE
    construct?
    Have you considered using dynamic SQL and then executing the concated
    string?

    Regards,
    John

    "Matias Woloski" <woloski@NO.SPAMsion.com> wrote in message
    news:e3vbYcVKEHA.2456@TK2MSFTNGP12.phx.gbl...
    > Thanks.
    >
    > I know CASE cannot be used there... The problem is that I want to keep the
    > query small... there are lot of alternatives in the query, I don't want to
    > copy paste the query all over the place...
    > You know this is easy using COALESCE, but doesn't work with CONTAINS
    > WHERE
    > someField = COALESCE( @someField, someField)
    >
    > This is an optional filter for the query... the problem is that by using
    > CONTAINS, I cannot use COALESCE in this way...
    >
    > Matias
    >
    > "John Kane" <jt-kane@comcast.net> wrote in message
    > news:%235ok0KVKEHA.3436@tk2msftngp13.phx.gbl...
    > > Matias,
    > > I'm not sure if a CASE construct can be used is such as you describe
    > below,
    > > but you might want to instead consider an IF... THEN ...ELSE construct,
    > for
    > > example:
    > >
    > > -- FTS and IF/THEN/ELSE construct
    > > Declare @searchstring varchar(255)
    > > if(@param1 = '')
    > > SELECT * FROM address
    > > else
    > > SELECT * FROM address WHERE CONTAINS(name, @searchstring)
    > >
    > > Regards,
    > > John
    > >
    > >
    > >
    > > "Matias Woloski" <woloski@NO.SPAMsion.com> wrote in message
    > > news:urzmDWUKEHA.1000@TK2MSFTNGP11.phx.gbl...
    > > > Hi guys,
    > > >
    > > > I'm using FTS on sql server 2000
    > > >
    > > > I would like to write a stored proc that accepts conditional CONTAINS.
    > > This
    > > > means that if @param1 was provided I want to apply CONTAINS with
    certain
    > > > column if not apply it to the other column
    > > >
    > > > WHERE
    > > >
    > > > CASE
    > > >
    > > > WHEN @param2 IS NULL THEN CONTAINS(param1, @param1)
    > > >
    > > > ELSE CONTAINS(param2, @param2)
    > > >
    > > > END
    > > >
    > > > Something like that I would like to do... But something that works ;)
    > > >
    > > > Thanks,
    > > >
    > > > Matias
    > > >
    > > >
    > > >
    > >
    > >
    >
    >


  • Next message: James Bradley: "Re: What's the deal with PAGEIOLATCH_SH?"

    Relevant Pages

    • Re: References choice...
      ... Then you can use it in code, to use it in a query - you need to make a public function, which returns this variable value, and use this function in a query ... Best regards, ... Is it possible to define constant 'A' that would pick a value from combobox ... >> in general - you need to have min 3 references in Access ...
      (microsoft.public.access.modulesdaovba)
    • Re: Webdav htmldescription tag missing from response
      ... Instead of DAV:htmldescriptions, you must query urn:schemas:httpmail:htmldescription ... Best regards, ... the reason why no html description is returned in this case, ... > Webdav and has been quite happy for sometime. ...
      (microsoft.public.exchange.applications)
    • Re: date useage in vb expression
      ... > a WHERE clause rather than a named filter or query. ... >> End Sub ... >> Best regards ... >> Scott B ...
      (microsoft.public.access.formscoding)
    • Re: Query to use like values from other table
      ... or similar to above query. ... Best Regards, ... Luqman ... >> The ways I know is either use union query ...
      (microsoft.public.sqlserver.programming)
    • Re: join problem
      ... Regards ... Your query would start with the ... >> Absatz means sales in german and Mitarbeiter is Employee.ABSATZVORJAHR ...
      (microsoft.public.access.queries)