Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

cte in sql server

/*
CTE: Common Table Expressions 
It is a temporary named result set that you can reference within 
a SELECT, INSERT, UPDATE, or DELETE statement.
*/
WITH    
odd_num_cte (id, n) AS    
(    
SELECT 1, 1     
UNION ALL    
SELECT id+1, n+2 from odd_num_cte where id < 5     
)    
SELECT * FROM odd_num_cte;  
Source by dbfiddle.uk #
 
PREVIOUS NEXT
Tagged: #cte #sql #server
ADD COMMENT
Topic
Name
2+7 =