You can use CROSS APPLY with a numbers table. This article shows you one way to create a numbers table
Generating a Sequence in SQL[
^] or more in depth here
The SQL Server Numbers Table, Explained - Part 1[
^]
Then you can do something like this
create table #src (id int identity(1,1), player varchar(20), [repeat] int)
insert into #src (player, [repeat]) values
('Sachin', 3),
('Ganguly', 2),
('Dravid', 4)
declare @m int = (SELECT Max([repeat]) from #src)
;WITH q AS
(
SELECT 1 AS num
UNION ALL
SELECT num + 1
FROM q
WHERE num < @m
)
SELECT num INTO #nos FROM q
SELECT A.*
FROM #src A
CROSS APPLY #nos B
WHERE B.num <= A.[repeat]
ORDER BY id
Giving the following results:
1 Sachin 3
1 Sachin 3
1 Sachin 3
2 Ganguly 2
2 Ganguly 2
3 Dravid 4
3 Dravid 4
3 Dravid 4
3 Dravid 4
[EDIT] just re-read my solution against your post - you probably want that last select to be
SELECT A.id, A.player, 1 as [repeat]
to get the exact results you mentioned