title: How to do Sql Server CE table update from another table
body: <p>I have this sql:</p>
  
  <pre><code>UPDATE JOBMAKE SET WIP_STATUS='10sched1'
  WHERE JBT_TYPE IN (SELECT JBT_TYPE FROM JOBVISIT WHERE JVST_ID = 21)
  AND JOB_NUMBER IN (SELECT JOB_NUMBER FROM JOBVISIT WHERE JVST_ID = 21)
  </code></pre>
  
  <p>It works until I turn it into a parameterised query:</p>
  
  <pre><code>UPDATE JOBMAKE SET WIP_STATUS='10sched1'
  WHERE JBT_TYPE IN (SELECT JBT_TYPE FROM JOBVISIT WHERE JVST_ID = @jvst_id)
  AND JOB_NUMBER IN (SELECT JOB_NUMBER FROM JOBVISIT WHERE JVST_ID = @jvst_id)
  
  Duplicated parameter names are not allowed. [  Parameter name = @jvst_id ]
  </code></pre>
  
  <p>I tried this (which i think would work in SQL SERVER 2005 - although I haven't tried it):</p>
  
  <pre><code>UPDATE JOBMAKE 
  SET WIP_STATUS='10sched1' 
  FROM JOBMAKE JM,JOBVISIT JV
  WHERE  JM.JOB_NUMBER = JV.JOB_NUMBER
  AND JM.JBT_TYPE = JV.JBT_TYPE 
  AND JV.JVST_ID = 21
  There was an error parsing the query. [ Token line number = 3,Token line offset = 1,Token in error = FROM ]
  </code></pre>
  
  <p>So, I can write dynamic sql instead of using parameters, or I can pass in 2 parameters with the same value, but does someone know how to do this a better way?</p>
  
  <p>Colin</p>