If you're going to run this against sets of rows, consider writing it as an inline table-valued funcation.
CREATE FUNCTION dbo.tfn_DotSplitFuncation
(
@OutlineNumber VARCHAR(1000)
)
RETURNS TABLE
AS
RETURN
(
with cte (outlineNumber) as (select replace(replace('.^.','^',@outlineNumber),'..','.'))
SELECT STUFF(SUBSTRING(OutlineNumber,1,CHARINDEX('.',OutlineNumber,N+1)),1,1,'') AS OutlineNumber
FROM dbo.Tally
CROSS JOIN CTE
WHERE N < LEN(OutlineNumber)
AND SUBSTRING(OutlineNumber,N,1) = '.'
)
GO
/* test
-- get down, get funky
;with test (oln) as
(select 'I.A.2.g' union all
select 'IV.C.12,a' union all
select 'XIII.B.1,c,ii'
)
select *
from test
cross apply dbo.tfn_DotSplitFuncation(oln)
*/
Lutz, I stole your excellent code and just added a wrinkle to make starting and ending periods irrelevant.
Now pardon me, while I show my age....
"Awwww we want the func.... give up the func.... aww we need the func... gotta have that func!!"
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills