Sample Header Ad - 728x90

How did you split strings before string_split()

3 votes
3 answers
5578 views
I have some strings I need to split on a SQL Server 2014 instance. I would normally do it something like this: declare @bk nvarchar(1000) set @bk = 'SIS5.0~person_id~696969' select value from string_split(@bk, '~') and I can also do it like this: declare @bk nvarchar(1000) set @bk = 'SIS5.0~person_id~696969' ;with hizizzle as ( select left(@bk, charindex('~', @bk)-1) as flippity, right(@bk, len(@bk) - charindex('~', @bk)) as floppity) select flippity, left(floppity, charindex('~',floppity)-1) as floppity, right(floppity, len(floppity) - charindex('~', floppity)) as flooo from hizizzle ...but there must be a better way, right? **Question:** How did you do string splits in the ancient past before 2014?
Asked by James (2668 rep)
Jan 7, 2020, 05:49 PM
Last activity: Jan 8, 2020, 10:04 PM