title: CREATE PROCEDURE gets "Msg 6567, Level 16, State 2" for SQLCLR stored procedure
body: <p>I have an issue getting SQL Server to create the stored procedure for my CLR function. </p>
  
  <p>This is the error I get:</p>
  
  <blockquote>
    <p>Msg 6567, Level 16, State 2, Procedure PerfInsert, Line 12 [Batch Start Line 0]<br>
    CREATE PROCEDURE failed because a CLR Procedure may only be defined on CLR methods that return either SqlInt32, System.Int32, System.Nullable, void.</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>
  
  <p>(Updated) C# code:</p>
  
  <pre><code>using Microsoft.SqlServer.Server;
  using System;
  using System.Data;
  using System.Data.SqlClient;
  using System.Data.SqlTypes;
  using System.Diagnostics;
  
      namespace MiddleMan
  {
      public static class MiddleMan
      {
          [SqlProcedure(Name = "PerfInsert")]
          public static SqlInt32 CreateCommand(SqlChars tblString, SqlChars featureName, SqlChars connectionString, SqlChars perfionConnectionString, SqlChars logFile)
          {
              Process compiler = new Process();
              compiler.StartInfo.FileName = "C:\\SQL Server C# Functions\\PerfionLoader\\PerfionLoader\\bin\\Release\\PerfionLoader.exe";
              compiler.StartInfo.Arguments = tblString.Value + " " + featureName.Value + " " + connectionString.Value + " " + perfionConnectionString.Value + " " + logFile.Value;
              //compiler.StartInfo.UseShellExecute = false;
              //compiler.StartInfo.RedirectStandardOutput = true;
              compiler.Start();
              return SqlInt32.Zero;
          }
      }
  }
  </code></pre>
  
  <p>(Updated) SQL code:</p>
  
  <pre><code>CREATE PROCEDURE PerfInsert
      (
          @tblString nvarchar(max)
          , @featureName nvarchar(max)
          , @connectionString nvarchar(max)
          , @perfionConnectionString nvarchar(max)
          , @logFiel nvarchar(max)
      )
      AS EXTERNAL NAME PerfInsert.[MiddleMan.MiddleMan].[CreateCommand]
  GO
  </code></pre>