title: Creating a stored procedure in SQL Server 2008 that will do a "facebook search"
body: <p>I'm trying to implement a facebook search in my system (auto suggest while typing).
  I've managed to code all the ajax stuff, but I'm not sure how to query the database.</p>
  
  <p>I've created a table called People which contains the fields: ID, FirstName, LastName, MiddleName, Email.
  I've also created a FTS-index on all those fields.</p>
  
  <p>I want to create a stored procedure that will get as a parameter the text inserted in the query box and returns the suggestions.</p>
  
  <p>For example, When I will write in the textbox the query "Joh Do"
  It will translate to the query:</p>
  
  <pre><code>select * from People where contains(*, '"Joh*"') and contains(*, '"Do*"')
  </code></pre>
  
  <p>Is there a way to do that in stored procedure?</p>
  
  <p>P.S
  I've tried to use the syntax</p>
  
  <pre><code>select * from People where contains(*,'"Joh*" and "Do*"')
  </code></pre>
  
  <p>but it didn't returned the expected results, probably because it needs to search the words on different fields. Is there a way to fix that?</p>
  
  <p>Thanks.</p>