title: Delphi: how to pass a list as a parameter to a SQL query?
body: <p>I have a list of integers or of strings and need to pass it as a parameter for a Delphi DataSet. How to do it?</p>
  
  <p>Here is an example. MyQuery is something like:</p>
  
  <pre><code>select * from myTable where intKey in :listParam
  </code></pre>
  
  <p>I'd set a parameter as a list or array or something else:</p>
  
  <pre><code>MyQuery.ParamByName('listParam').AsSomething := [1,2,3];
  </code></pre>
  
  <p>and it would result in this query sent to the sql server:</p>
  
  <pre><code>select * from myTable where intKey in (1, 2, 3)
  </code></pre>
  
  <p>It would be even better if the solution would also work with strings, making this query:</p>
  
  <pre><code>select * from myTable where stringKey in :listParam
  </code></pre>
  
  <p>become:</p>
  
  <pre><code>select * from myTable where stringKey in ('a', 'b', 'c')
  </code></pre>
  
  <p>I believe this is a simple question, but "IN" isn't a good keyword for searching the web.</p>
  
  <p>Please answer how I should configure the parameter in the IDE, the query and how to pass the parameters.</p>
  
  <p>I'm using Delphi 7.</p>
  
  <p><strong>Edited</strong>: I'm considering the answer is "<em>it isn't possible to do directly</em>". If someone give me a non-hackish answer, the accepted answer will be changed.</p>