Can I use a CTE inside a user defined function? If so, could you lead me to
an example.
Thanks,
jione example
create function fn1()
returns table
as
return(with fact_tbl as
(select 1 as num,cast(1 as bigint) as fact
union all
select num+1,fact*(num + 1) from fact_tbl where num < 20)
select * from fact_tbl
)
-Omnibuzz (The SQL GC)
http://omnibuzz-sql.blogspot.com/|||Thank you...
"Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message
news:C534E46E-7279-482A-AF2F-4694086794B7@.microsoft.com...
> one example
> create function fn1()
> returns table
> as
> return(with fact_tbl as
> (select 1 as num,cast(1 as bigint) as fact
> union all
> select num+1,fact*(num + 1) from fact_tbl where num < 20)
> select * from fact_tbl
> )
> --
> -Omnibuzz (The SQL GC)
> http://omnibuzz-sql.blogspot.com/
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment