Skip to content
Advertisement

STRING_SPLIT in TSQL on MS Server creates list with repeating values. WHY?

I am using 2017 MS SQL Express. The following code creates this erroneous result. Any clues why?

Advertisement

Answer

You are using cross apply which is applying your join on 2 tables where result contain table on left with all the columns and table on right with matching values.

Since in this query dbo.together has 2 rows and for each value in string_split it generate same number of rows. 1:n relation in between these 2 tables.

You may find this link for more details on CROSS APPLY.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement