order by charindex >0 and SQL concat : <p>I want to order Recordset by setting priority when ID is in an array:</p>

<p>This is the comma separated <strong>myString</strong> which holds a series of ID: <code>,1,2,4,6,8,12,34,</code></p>

<p>I use concat to add comma before and after ID so I can compare it against the string:</p>

<pre><code>sql="select * from customers order by case when charindex( concat(','," &amp; id &amp; ",',') , '" &amp; myString &amp; "' )&gt;0 then 1 else 0 end desc"
</code></pre>

<p>I get <strong>syntax error</strong> message. I am not sure if there is error in SQL structure as I used <code>concat</code> in deep structure or there is error in using quote and double quote?</p>
