sql to create folders

I want to query a database and create folders in PDM from it.  How could I do that?

SolidworksSolidworks Pdm/enterprise Pdm