INSERTING HUGE DATA in a Table to check PerformanceIssues.
CREATE TABLE TblNumbers
(ID int identity(1,1) primary key,Num INT)
go
;WITH N
AS
(
select 0 as Num
union all
select 0
union all
select 0
union all
select 0
union all
select 0
union all
select 0
union all
select 0
union all
select 0
union all
select 0
union all
select 0--10
)
,Numbers AS
(
SELECT ROW_NUMBER()OVER(ORDER BY (SELECT 1))AS Rn
FROM N N1,--10rows
N N2,-->10*10=100
N N3,-->10*10*10=1000
N N4,---->10*10*10*10=10000
N N5,------>10*10*10*10*10=100000
N N6,--10*10*10*10*10*10=1000000
N N7,--10*10*10*10*10*10*10=10000 000
N N8,
N N9
)
INSERT INTO TblNumbers
(Num)
SELECT Rn
FROM Numbers
SELECT * FROM TblNumbers
(ID int identity(1,1) primary key,Num INT)
go
;WITH N
AS
(
select 0 as Num
union all
select 0
union all
select 0
union all
select 0
union all
select 0
union all
select 0
union all
select 0
union all
select 0
union all
select 0
union all
select 0--10
)
,Numbers AS
(
SELECT ROW_NUMBER()OVER(ORDER BY (SELECT 1))AS Rn
FROM N N1,--10rows
N N2,-->10*10=100
N N3,-->10*10*10=1000
N N4,---->10*10*10*10=10000
N N5,------>10*10*10*10*10=100000
N N6,--10*10*10*10*10*10=1000000
N N7,--10*10*10*10*10*10*10=10000 000
N N8,
N N9
)
INSERT INTO TblNumbers
(Num)
SELECT Rn
FROM Numbers
SELECT * FROM TblNumbers
Comments