→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
feffrey
Engaged Sweeper
I don't use SQL too much so I am probably doing this wrong, but what is the correct way to remove strings from a table?
In a custom report I have a column that displays the OU the computer is in. I want it to just show the final OU that the computer is in and not the full OU path. Right now I am doing that by nesting replace expressions which works, but I am at the 128 character limit. What is the correct way to filter out unwanted text?
1 ACCEPTED SOLUTION
Susan_A
Lansweeper Alumni
FYI for everyone: this report example shows how you can shorten OUs.

View solution in original post

2 REPLIES 2
Susan_A
Lansweeper Alumni
FYI for everyone: this report example shows how you can shorten OUs.
RCorbeil
Honored Sweeper II
Is there specific text you can search for to delimit the text that you want to retain?

See Microsoft's T-SQL string functions.

You can use CharIndex or PatIndex to find a start/end point (Reverse if you need to search backward from the end of the string) and Left/Right/Substring to extract the text you want to retain.

[Edit to add:]
Suggestion: If you're not sure how to make it work, provide an example of the string you're trying to extract from and identify what text you're trying to extract from it.