title: Comparing data in two tables,insert if data is not there,update if data is there
body: <p>I have two tables</p>
  
  <pre><code>SELECT * FROM dbo.VMM_Table_20120210     table 1
  </code></pre>
  
  <p>and output of this table is </p>
  
  <pre><code>vehicle_Make        vehicle_model
  ---------------------------
  01                   000
  01                   111
  01                   112
  01                   113
  01                   114
  01                   115
  01                   117
  </code></pre>
  
  <p>like this upto 993 records r there in the above table
  and 2nd table is </p>
  
  <pre><code>SELECT * FROM dbo.TBL_VEHICLE_MODEL_NEW
  </code></pre>
  
  <p>and output of this table is</p>
  
  <pre><code>vmodel_id    vmodel_vmake_code       vmodel_type    vmodel_code
  ---------------------------------------------------------------------------
  1             01                         t             7AV
  2             01                         c             7AE
  </code></pre>
  
  <p>UPTO 1107 records are there in this table</p>
  
  <p>the requirement is I need to compare vehicle_make with vmodel_vmake_code and vehicle_model with vmodel_code and If data is not there in the 2nd table I need to insert it from the first table if data is there I need to update the data</p>
  
  <p>I need it procedure with cursor in the procedure to loop the each row will u please help me in this situation</p>