Check out example codes for "tsql generate rows". It will help you in understanding the concepts better.

Code Example 1

-- generate a identity, and guid table without looping
;with guids( i, guid ) as
(
    select 1 as i, newid()
        union all
    select i + 1, newid()
        from guids
        where i < 10000
)

select i, guid   
from guids 
order by i desc

Learn ReactJs, React Native from akashmittal.com