Creating #temp before CTE SQL Server 2012 -


i need create #temp table before list of cte:s start can use in end perform calculations.

this have written far:

select distinct  sum(x+y) total  #summary table  cte_start (   select distinct *   tablex ) 

....

i have tried creating #summary cte , writing before from. not work.

i have looked @ similar questions on:cte&temp table

i have not found helpful. how can create #temp table before cte_start begins processing?

you need terminate statement before cte semicolon, otherwise sql server doesn't know with isn't part of previous statement, example part of table hint.

for example:

select distinct sum(x+y) total #summary table;  cte_start ( select distinct * tablex )  select * cte_start 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -