title: SQL Server : return string procedure INITCAP
body: <p>This is what I've done.</p>
  
  <pre><code>create proc INITCAP(@string varchar(30))
  as
  begin
      SET @string = UPPER(LEFT(@string,1)) + LOWER(RIGHT(@string, LEN(@string) -1))
  end
  
  declare @lastname varchar
  set @lastname = exec INITCAP 'MILLER'
  
  declare @firstname varchar
  set @firstname = exec INITCAP 'StEvE'
  
  UPDATE Employee SET firstname = @firstname, lastname = @lastname WHERE empID = 7934
  </code></pre>
  
  <p>I keep getting the errors:</p>
  
  <blockquote>
    <p>Msg 156, Level 15, State 1, Procedure INITCAP, Line 97<br>
    Incorrect syntax near the keyword 'exec'.<br>
    Msg 156, Level 15, State 1, Procedure INITCAP, Line 100<br>
    Incorrect syntax near the keyword 'exec'.</p>
  </blockquote>
  
  <p>What shall I do? I want the procedure <code>INITCAP</code> to work as it does in Oracle: to return a name like: "Steve", "Miller"</p>