title: sql create string variable with column names
body: <p>i'm trying to create a dynamic sql statement either thru sql code or c# code. For example, I'd like to generate a result set based on a string containing a table name. Currently, I am doing this thru c# code.</p>
  
  <p>My current issue is I'd like to generate a search similar to following</p>
  
  <pre><code>select * from customers
  where ContactName+City like '%Berlin%'
  </code></pre>
  
  <p>so I'm thinking given a table name as a string parameter I need to somehow produce a string variable <code>'ContactName+City+etc'</code> to build part of the search</p>
  
  <p>I'm open to any other ideas as well. </p>
  
  <pre><code>var sql = string.Format(@"
  select * from {0}
  where {1} like '%criteria%'"
  , variable_table
  , "column1+column2+columnX"); //need function here to produce this string based on variable table?
  </code></pre>
  
  <p><strong>Basically</strong>, how would I create a string that concatenates a variable number of columns together (<code>'ContactName+City+etc'</code>) based on a variable_table?</p>