Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
SELECT @Output = CASE WHEN Data > LEN(@String) THEN @Output + @Delimeter ELSE STUFF(CASE WHEN RN = 1 THEN @String ELSE @Output END, Data + RN - 1, @Occurance, @Delimeter) END FROM ( SELECT Data = CAST(Data AS INT) + CASE WHEN @Occurance = 0 THEN 1 ELSE 0 END, RN = ROW_NUMBER() OVER (ORDER BY LEN(Data), Data) FROM dbo.fnParseList(',', @Location) )Src ORDER BY RN
RETURN @Output END [/code]
webfred
Master Smack Fu Yak Hacker
8781 Posts
Posted - 2013-10-04 : 03:44:52
Hi Waterduck,
please give us a few words on when/why to use how to use etc.
Thx Webfred
Too old to Rock'n'Roll too young to die.
waterduck
Aged Yak Warrior
982 Posts
Posted - 2013-10-04 : 04:43:31
Sorry, forgot the example.
It meant for insert character/string into multiple location.