Как я и обещал, я бы сделал лучшее решение сегодня. Я знаю, что вам понравится и, скорее всего, использовать его.
DECLARE @t TABLE(ID INT , Row INT, Data VARCHAR(10))
Insert INTO @t
SELECT 1, 1,'a2b' UNION All SELECT 1,2,'p1d1' UNION All SELECT 2,1,'abcd'
;WITH cte(id, row, num, data)
AS (
SELECT id, row, 1 num,CAST(data as VARCHAR(10)) data
FROM @t
UNION ALL
SELECT ch.id, row, CH.num +1, CAST(REPLACE(ch.data, ch.num, REPLICATE('X', ch.num)) as VARCHAR(10))
FROM cte ch
WHERE ch.num < 9 )
, cte2(id, rowcol, row, num, data, chars, LEVEL) as
(SELECT id, CHAR(97) + CAST(row AS CHAR) rowcol, row, num, data, SUBSTRING(data, 1, 1), 1 LEVEL
FROM cte
where num = 9
UNION all
SELECT id, CHAR(97 + LEVEL) + CAST(row AS CHAR) rowcol, row, num, data, SUBSTRING(data, LEVEL + 1, 1), LEVEL + 1
FROM cte2 ch
where LEVEL < LEN(data)
)
SELECT ID, rowcol, chars
FROM CTE2
ORDER BY id, data, rowcol