Just declaration of a temporary table with single column
insert statement to insert one row in temporary table @temp1
Here is code of common table expression in sql
declare @temp1 table
(
id int
)
insert statement to insert one row in temporary table @temp1
insert into @temp1 select 1common table expression example to recursively increase the column Id. i think this is the most simple example of looping or recursion to print 1 to 10 with out printing each statement individually .... :)
Here is code of common table expression in sql
;with cte Assql fiddle for this post can be find here sqlfiddle link
(
select id from @temp1
union all
select id+1 from cte where id<10 br="br"> )
select * from cte 10>
No comments:
Post a Comment