
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2021 09:26 PM
When I add tblADComputers.OU into a report, it prints the entire OU. Is there a way to have it only print the lowest level OU?
Ex:
Instead of printing `OU=WebServers,OU=Servers,OU=Computers,DC=EXAMPLE,DC=COM`
Just print `OU=WebServers`
Or even just `WebServers`
Ex:
Instead of printing `OU=WebServers,OU=Servers,OU=Computers,DC=EXAMPLE,DC=COM`
Just print `OU=WebServers`
Or even just `WebServers`
Labels:
- Labels:
-
Report Center
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2021 10:08 PM
Take a look at the T-SQL string functions. You can use CharIndex() to check for the presence of a comma and, if present, return a truncated string using Left(), something like
The simplest way to drop the "OU=" would probably be to wrap the CASE in a Replace().
CASE
WHEN CharIndex(',', fullOU) > 0
THEN Left(fullOU, CharIndex(',', fullOU)-1)
ELSE fullOU
END AS lowOU
The simplest way to drop the "OU=" would probably be to wrap the CASE in a Replace().
