title: SQL to C# conversion
body: <p>I have a working process, behind a web application, that is generating some records in a table, it is so general, that I actually had to add SQL (where clause) as Data in a table.</p>
  
  <p>It looks something like this (don't mind the quotes):</p>
  
  <pre><code> SET @sql = '(((1.00 &lt; col_a) 
       AND (col_a &lt; 5.00))) 
       AND NOT LEFT(col_b, 4) IN ('something') 
       OR ( CHARINDEX('cucu', col_c) &gt; 0 ) 
       AND NOT ISNULL(col_d, '') &lt;&gt; '' 
       AND ((1.00 &lt; CONVERT(FLOAT, col_e)) 
       AND (CONVERT(FLOAT, col_f)&lt; 5.00)) 
       AND NOT col_g IN ('10') '
  </code></pre>
  
  <p>It works all right, no complaints, but the client would like to have an in-code approach, I am not really sure why.
  So instead of using a scheduled SQL job, running my stored procedure, I guess I will make all this to be somehow rebuilt in C# desktop application, which is doing the same thing.</p>
  
  <p>I would like to know if there is a way for me to use my code (like my @sql example above) somehow from C#. I mean some kind of compile, or anything.</p>
  
  <p>I thought I would just select the results in a DataTable, and THEN apply my @sql over that DataTable somehow. I would like to narrow down the original DataTable's results using that where clause.</p>
  
  <p>If I don't do something like this, I am afraid I will have to change the entire saving (of @sql) process too, which would make the task even bigger.</p>
  
  <p>I am using SQL 2k5, the client has sql 2k8 (we'll be upgrading soon) and the desktop app I would build in C#.</p>