shlogg · Early preview
Judy @esproc_spl

Extracting Top-Level Folders From Database Table Using SPL Script

Finding top-level directories from database table TBLFOLDERS. Desired result: C:\Folder1, C:\Folder2\Subfolder1. SPL script p1.dfx used to extract top-level folders.

Problem description & analysis
We have a database table TBLFOLDERS as follows:

We are trying to find all top-level directories from it. Below is the desired result:
C:\Folder1
C:\Folder2\Subfolder1
Solution
We write the following SPL script p1.dfx within esProc:

Explanation:
A1   Connect to database mssql.
A2   Return a table sequence and auto-close the database connection when execution is finished.
A3  Find strings that are not contained in all the other strings.
Refer to How to Call an SPL SCript in Java to learn about how to integrate the SPL script with a Java program.
Q & A Collection...