title: SQL Server 2008 - Full Text Query
body: <p>I have two tables in a SQL Server 2008 database in my company. The first table represents the products that my company sells. The second table contains the product manufacturer’s details. These tables are defined as follows:</p>
  
  <pre><code>  Product
    -------
    ID
    Name
    ManufacturerID
    Description
  
    Manufacturer
    ------------
    ID
    Name
  </code></pre>
  
  <p>As you can imagine, I want to make this as easy as possible for our customers to query this data. However, I’m having problems writing a forgiving, yet powerful search query. For instance, I’m anticipating people to search based on phonetical spellings. Because of this, the data may not match the exact data in my database.  In addition, I think some individuals will search by manufacturer’s name first, but I want the matching product names to appear first. Based on these requirements, I’m currently working on the following query:</p>
  
  <pre><code>  select
      p.Name as 'ProductName',
      m.Name as 'Manufacturer',
      r.Rank as 'Rank'
    from
      Product p inner join Manufacturer m on p.ManufacturerID=m.ID
        inner join CONTAINSTABLE(Product, Name, @searchQuery) as r
  </code></pre>
  
  <p>Oddly, this query is throwing an error. However, I have no idea why. Squiggles appear to the right of the last parenthesis in management studio. The tool tip says "An expression of non-boolean type specified in a context where a condition is expected". I understand what this statement means. However, I guess I do not know how COntainsTable works. What am I doing wrong?</p>
  
  <p>Thank you</p>