title: Using the result of an expression (e.g. Function call) in a stored procedure parameter list?
body: <p>I am trying to write a stored procedure to assist with development of our database, but I am having some trouble using it. For example:</p>
  
  <pre><code>DECLARE @pID int;
  SET @pID = 1;
  EXEC WriteLog 'Component', 'Source', 'Could not find given id: ' + CAST(@pID AS varchar);
  </code></pre>
  
  <p>This yields the error (on SQL Server 2005):</p>
  
  <blockquote>
    <p>Msg 102, Level 15, State 1, Line 4
    Incorrect syntax near '+'.</p>
  </blockquote>
  
  <p>Can someone explain to me why my syntax is incorrect, and the right way to solve this problem?</p>