Wanted to explore one of the major limitation of CTE in sql 2012 i.e. it cannot be used inside if else statement . This is something basic as the definition of cte that it must be followed by a select, insert, update or delete statement.
That is we cannot have following condition:-
with cte
(
)
if
select cte
else
select cte
end
Thanks