July 25, 2022 at 6:34 am
Read this: Author Jeff Moden - Article: Tally OH! An Improved SQL 8K “CSV Splitter” Function, http://www.sqlservercentral.com/articles/Tally+Table/72993/
Example query:
SELECT ACC.ts_easeofworking
, GOM.ts_easeofworking
, ACC.ts_companytype
, GOM.ts_companytype [ts_companytype_multi_valued_string]
, Splitter.ItemNumber
, Splitter.Item
FROM GlobalOptionsetMetadata GOM
CROSS APPLY dbo.DelimitedSplit8k(GOM.ts_companytype,';') Splitter
INNER JOIN account ACC
ON ACC.ts_easeofworking = GOM.ts_easeofworking
AND ACC.ts_companytype = Splitter.Item
Basically, dbo.DelimitedSplit8k splits your string column into a virtual table based on the provided split-character
Install it, and test it ( even if you do not understand it 100% )
So it will turn '123;456;78900' into
ItemNumber Item
1 123
2 456
3 78900
As you may have understood by now, it certainly is not the most optimal way to store relationship data in a csv column.
Start small, see what it does and where it gets you.
Then build on that.
p.s. I've been off the grid for a couple of days .... time of the year
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
Viewing post 16 (of 15 total)
You must be logged in to reply to this topic. Login to reply