title: 1 stored procedure with flexible parameters, or many stored procedures?
body: <p>I'd like to get your opinion on 2 ways of implementing the same stored procedure. Any advice would be greatly appreciated. </p>
  
  <p><strong>Implementation 1</strong></p>
  
  <pre><code>CREATE PROC GetFileSize(@Path varchar(500) = NULL, @FileID int = NULL)
  AS 
       IF @Path IS NULL 
           ' Find the file by @FileID and return its size
       ELSE
           ' Find the file by @Path and return its size
  </code></pre>
  
  <p><strong>Implementation 2</strong></p>
  
  <pre><code>CREATE PROC GetFileSizeByPath(@Path varchar(500))
  AS
  
  CREATE PROC GetFileSizeByFileID(@FileID int)
  AS
  </code></pre>
  
  <p>Which implementation do you prefer and why? </p>
  
  <p>Cheers,
  Mosh</p>