Is PARSENAME safe for general parsing and splitting?

Thanks, not seen that STRING_SPLIT(string, separator) was imminent :slight_smile: ... all those man-years of optimisation of Splitter Functions thrown away in an instant ...

But for this job that sort of splitter will split to Rows when Columns is (I think?) more desirable. Heck .. for the job of splitting to columns I have Code that will mechanically generate the CHARINDEX "stuff" to split a delimited, multi-column, value. I used mechanically-generated because the resulting code is horrid! for example for a 4-part split on "-" delimiter I get:

SELECT
  [Part_1] = substring(MyObjectName + '-', 0 + 1, charindex('-', MyObjectName + '-', 0 + 1) - 0 - 1 )
, [Part_2] = substring(MyObjectName + '-',  charindex('-', MyObjectName + '-') + 1, charindex('-', MyObjectName + '-',  charindex('-', MyObjectName + '-') + 1) -  charindex('-', MyObjectName + '-') - 1 )
, [Part_3] = substring(MyObjectName + '-',  charindex('-', MyObjectName + '-',  charindex('-', MyObjectName + '-') + 1) + 1, charindex('-', MyObjectName + '-',  charindex('-', MyObjectName + '-',  charindex('-', MyObjectName + '-') + 1) + 1) -  charindex('-', MyObjectName + '-',  charindex('-', MyObjectName + '-') + 1) - 1 )
, [Part_4] = substring(MyObjectName + '-',  charindex('-', MyObjectName + '-',  charindex('-', MyObjectName + '-',  charindex('-', MyObjectName + '-') + 1) + 1) + 1, charindex('-', MyObjectName + '-',  charindex('-', MyObjectName + '-',  charindex('-', MyObjectName + '-',  charindex('-', MyObjectName + '-') + 1) + 1) + 1) -  charindex('-', MyObjectName + '-',  charindex('-', MyObjectName + '-',  charindex('-', MyObjectName + '-') + 1) + 1) - 1 )
FROM
(
	SELECT	[MyObjectName] = '444-333-222-111'
) AS X