title: SQL Server stored procedure concat string as query
body: <p>I wonder if can I define some parts of the my sql query as a string.</p>
  
  <p>I worked on the code below but I could not manage to concat that pre-defined string part to the existing query.</p>
  
  <p>Actually <code>@sirketid</code>, <code>@uzman</code>, <code>@basvurukodu</code> params works well, however the <code>@ORA_BASVURU_KESIN_KOSUL</code> param is causing a problem.</p>
  
  <p>I think because it has some sql-spesific expression like <strong><em>and</em></strong>, it is treated diffrently than simple variables used for comparison or assigning such as <code>@sirket_id</code>.</p>
  
  <p>It does not throw any error message, the code simply does not excute the operation.</p>
  
  <pre><code>SET @ORA_BASVURU_KESIN_KOSUL = 'and akftif = 1';
  
  UPDATE basvuru 
  SET sirket = @sirketid,
      talep_gorevlendirme_rapor = 'G',
      birimi = 'SS', 
      uzman = @uzman,
  WHERE
      kod = @basvurukodu + ' ' + @ORA_BASVURU_KESIN_KOSUL; 
  </code></pre>
  
  <p>Can I concat query parts like this, if so, how?</p>
  
  <p>Thanks</p>