mkamp81
asked on
sql extract data
How can I capture in SQL only the part that says OU=447 (or whatever number shows up)? I actually only need the number part.
I have this script to give me all the numbers in the string however, I still am not sure how to get the OU number by itself
I have this script to give me all the numbers in the string however, I still am not sure how to get the OU number by itself
;WITH T1(number) AS (SELECT 1 UNION ALL SELECT 1),
T2(number) AS (SELECT 1 FROM T1 AS a cross join T1 as b),
T3(number) AS (SELECT 1 FROM T2 AS a cross join T2 as b),
T4(number) AS (SELECT 1 FROM T3 AS a cross join T3 as b),
Nums(number) AS (SELECT ROW_NUMBER() OVER(ORDER BY (SELECT NULL))
from T4)
SELECT STUFF(
(SELECT '' + SUBSTRING(UserDN,Nums.number,1)
FROM Nums
WHERE ISNUMERIC(SUBSTRING(UserDN,Nums.numb er,1))=1
FOR XML PATH('')),1,0,'') as 'num'
from SSOLogs
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.