SQLTeam.com | Weblogs | Forums

Need to parse a column but with 2 possible scenarios

I have some data that needs to be parsed but it could be one of two scenarios: In the same column "Program_enrollment_name". There could be 2 types of data:

S1. (open Paren)
Extended Family AIM Support (YFCOS)  -  from 01/19/2021
S2. (dash)
Child Time Welfare Peer Counseling  -  from 11/22/2022

In S1, I need Extended Family AIM Support
and in S2, Child Time Welfare Peer Counseling

SELECT RTRIM(SUBSTRING(Program_enrollment_name,1
FROM myTable

Edit fixed RTRIM spelling

1 Like