Sample Header Ad - 728x90

string_split into multiple columns

0 votes
2 answers
5318 views
Sorry if this question is very basic, but I just can't figure it out, and couldn't find any good answers. I have a very long list of files, folders and Sizes. I need to Seperate the folders to columns, that I have a column for each folder. I have a FilePath as a String (eg folder1\folder2\folder3). I want to seperate this into multiple Columns: First | Second | Third | Fourth | ... folder1 | folder2 | folder3 | NULL | ... Foldera | folde rb | folderc | folderd | using cross apply string_split(PATH,'\')as folder I get Folder1. using row_Number() I can define wich folder I have in my column, but it is always only 1 column. Actual Example: select [Parentpath], [Size], [spl].[value] from Files cross apply string_split([ParentPath], '\') as [spl] Parentpath || Size || Value Business\Packets\Data\Archive || 29334 || Business
Asked by Gerrit (15 rep)
Oct 10, 2018, 08:13 AM
Last activity: Oct 10, 2018, 12:27 PM