→ Having trouble accessing our new support portal or creating a ticket? Please notify our team here

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
stahly8
Engaged Sweeper III
is there a way to shorten what is reported back by the OU field (tblADComputers.OU)

here is an example of what i am seeing and then how i would like it trimmed down to:

OU=Administration, OU=Domain Computers, DC=ourdomain, DC=org

Administration




thanks for any help
1 ACCEPTED SOLUTION
Hemoco
Lansweeper Alumni
You could try something like this:
Select Top 1000000 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblADComputers.OU,
SubString(SubString(tblADComputers.OU, CharIndex(',', tblADComputers.OU) -
250, 250), 4, 250) As ShortOU,
tblAssets.Firstseen,
tblAssets.Lastseen
From tblAssets
Inner Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Order By tblAssets.Domain,
tblAssets.AssetName

View solution in original post

3 REPLIES 3
stahly8
Engaged Sweeper III
thank you. i was able to update a couple of custom reports with this. thank you!
Hemoco
Lansweeper Alumni
You could try something like this:
Select Top 1000000 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblADComputers.OU,
SubString(SubString(tblADComputers.OU, CharIndex(',', tblADComputers.OU) -
250, 250), 4, 250) As ShortOU,
tblAssets.Firstseen,
tblAssets.Lastseen
From tblAssets
Inner Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Order By tblAssets.Domain,
tblAssets.AssetName
Ismail
Engaged Sweeper II
Bump! Id like to find out if there is a way to shorten OU