title: Dynamic SQL - Update Column by Prepending A Current Column
body: <p>I am trying to populate a column that is to represent an Internal URL that directs the user to a specific document. The document ID, <code>DOC_ID</code>, is already populated in the Table. I would like to populate the column by prepending a base URL to the Document ID. I do not know how to to do this dynamically and am getting some errors referring to the parameters of <code>CONCAT()</code>, issue being it is understanding it to be a string rather than the column value. My code is as follows: </p>
  
  <pre><code>SET @Insert_DRS_URL_SQL = 'UPDATE' 
                            + ' ' 
                            + QUOTENAME(@TBL) 
                            + ' ' 
                            + 'SET DRS_URL = CONCAT(@URLBASE' 
                            + ',' 
                            + 'DOC_ID' 
                            + ')'
  
  EXECUTE sp_executesql @Insert_DRS_URL_SQL;
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>@URLBASE = 'http://blah/blah/blah/id='
  </code></pre>
  
  <p><code>DRS_URL</code> is the column I wish to populate.</p>
  
  <p>Basically I need <code>DRS_URL</code> = <code>@BASEURL</code> + <code>DOC_ID</code> </p>