title: Searching for multiple keywords using SQL Server stored procedure
body: <p>I'm going to search my database (SQL Server 2008) using a stored procedure. My users can enter keyword(s) in a textbox (keywords can be separated using <code>,</code> for instance). </p>
  
  <p>Currently I'm using something like this:</p>
  
  <pre><code>keyword like N"%'+@SearchQuery%'%"
  </code></pre>
  
  <p>(<code>keyword</code> is a <code>nvarchar</code> column in my table, and <code>@SearchQuery</code> is the input to my stored procedure)</p>
  
  <p>It works fine but what if user types several keywords: apple,orange, banana</p>
  
  <p>Should I limit number of my keywords? How should I write my stored procedure if I have more than one keyword? How should I pass my user input to the stored procedure? I should pass <code>apple, orange, banana</code> as a whole phrase and then I should parse them in my stored procedure, or I should separate my keywords and send 3 keywords? How can I query these 3 keywords? A for loop?</p>
  
  <p>What are best practices for performing such queries?</p>
  
  <p>thanks</p>