0

We have a column that looks like this

CN=1245657,OU=TestOU,OU=East,OU=NorthPole,OU=Cali,OU=Computers,DC=test2,DC=Test1,DC=Test5

As you can see the string above has 5 OUs. The amount of OUs can range from 0 to 5 in the string. We need to make columns of the OU values. Like

OU1     OU2     OU3          OU4     OU5
----------------------------------------------
TestOU  East    NorthPole    Cali    Computers

In the event that the string has less than 5 OUs then OU5 will be blank. Is there a way to do this in plain SQL.

Luke101
  • 63,072
  • 85
  • 231
  • 359
  • Based on what you're saying, it looks like you're just storing a string in the database. So you can use any of the string functions in your vendor's database. Or you can just fetch the string and parse it in your language of choice (Perl, PHP, VB, Java - whatever) – paulsm4 May 03 '12 at 22:24
  • i really wish i could do that. But programming languages are not allowed – Luke101 May 03 '12 at 22:25

0 Answers0