I created a Query SQL Server that dismembers my Folders and transforms in rows (delimited by "\")
For example:
My folder is "N:\TESTEA\subTESTEB" originally. In my new table, this value is:
an folder name per row.
N:
TESTEA
subTESTEB
But, I need transform it's rows in columns. Row 1 in Column 1; Row 2 in Column 2; and so on.
Who know any solution for this? One problem: this folders have multi levels, and not a standard level!
I'm clear?
Below is my SQL Query (I don't know format this SQL code here!):
DECLARE @ARRAY VARCHAR(8000), @DELIMITADOR VARCHAR(100), @S VARCHAR(8000),@ARRAYFinal VARCHAR(8000)
select sub_folder_path into #sub_folder_path from GROUP_FOLDER_ACCESS
SELECT @DELIMITADOR = '\'
CREATE TABLE ARRAY(ITEM_ARRAY VARCHAR(8000))
WHILE (select COUNT(*) from #sub_folder_path) > 0
BEGIN
SELECT @ARRAY = sub_folder_path from #sub_folder_path ORDER BY sub_folder_path
SET @ARRAYFinal = @ARRAY
SET @ARRAY = @ARRAY + @DELIMITADOR
WHILE LEN(@ARRAY) > 0
BEGIN
SELECT @S = LTRIM(SUBSTRING(@ARRAY, 1, CHARINDEX(@DELIMITADOR, @ARRAY) - 1))
INSERT INTO ARRAY (ITEM_ARRAY) VALUES (@S)
SELECT @ARRAY = SUBSTRING(@ARRAY, CHARINDEX(@DELIMITADOR, @ARRAY) + 1, LEN(@ARRAY))
END
DELETE #sub_folder_path WHERE sub_folder_path = @ARRAYFinal
END