title: How can I use Case satement in CTE tsql?
body: <p>I want use case in cte with this code :</p>
  
  <pre><code>Declare @DefinitionType Int = 1
  ;With Res
  As
  (
      Case @DefinitionType
          When 1 Then (Select [ActionId], [Title] From Actions)
          When 2 Then (Select [AreaId], [Title] From Areas)
          Else (Select [ContractorScopeId], [Title] From ContractorScopes)
      End
  )
  Select * From Res
  </code></pre>
  
  <p>That error is :</p>
  
  <blockquote>
    <p>Msg 156, Level 15, State 1, Line 5<br>
    Incorrect syntax near the keyword 'Case'.</p>
  </blockquote>
  
  <p>How can I use Case satement in CTE ?</p>