Write a TSQL Script to generate a number table with 10Lac(10,00,000) records

Rajnilari2015
Posted by Rajnilari2015 under Sql Server category on | Points: 40 | Views : 1163
The below program will do so

--generate a number table with 10 Lac(10,00,000) rows
;with cte as(
select rn=1
union all
select rn=rn+1 from cte where rn<1000000 --10 Lac
)
--Project the record
Select *
From cte
option (maxrecursion 0)

At first we have generated a number table with 10 Lac (1000000) rows using recursive CTE. Finally we have projected the records.

Comments or Responses

Login to post response