I'm trying to query data from a column that has 3 values separated by " | " as a delimiter. I'm having trouble trying to extract the second value without creating an additional column
Example of data:
{cookie_data}
732711 | 732711@soundcorp.com | 732711 Store
I want to get the email portion only.
SELECT
SUBSTRING(cookie_data, CHARINDEX(' | ', cookie_data) + 3, LEN(cookie_data)) AS login_data,
SUBSTRING(login_data, 0, CHARINDEX(' | ', login_data)) AS email,
FROM TABLE
While this solution works, I was curious if there was an easier way of doing this without generating an extra column that isn't needed other than to create the final substring.