title: conditional where clause based on a stored procedure parameter?
body: <p>I have a SQL Server 2005 stored proc that takes a parameter: <code>@includeClosedProjects</code>.</p>
  
  <p>There's a <code>WHERE</code> clause that I want to control based on this param.</p>
  
  <pre><code>create proc sel_projects
  (@incClosedRel int = 1)
  as
  
  SELECT projectId, projectName
  FROM project
  WHERE CompletionStatusCID NOT IN (34, 35) &lt;-- controlled by @incClosedRel 
  </code></pre>
  
  <p>I want to get all projects (exclude the where clause), when <code>@incClosedRel =1</code>. 
  Otherwise, include the where clause.</p>