Hi @Joseph s ,
Welcome to Microsoft Q&A!
Please refer your previous post mentioned by other experts which is similar with this post. You could only replace '[]' with '()' in the queries.
Please also refer below:
SELECT *,LEFT(FieldName,CHARINDEX('(',FieldName)-2) COL1,
SUBSTRING(FieldName,CHARINDEX('(',FieldName)+1,LEN(FieldName)-CHARINDEX('(',FieldName)-1) COL2
FROM dbo.TableName
If '(' is missing in some rows, you could refer below:
SELECT *,CASE WHEN CHARINDEX('(',FieldName)<>0 THEN LEFT(FieldName,CHARINDEX('(',FieldName)-1) ELSE FieldName END COL1,
CASE WHEN CHARINDEX('(',FieldName)<>0 THEN SUBSTRING(FieldName,CHARINDEX('(',FieldName)+1,CHARINDEX(')',FieldName)-CHARINDEX('(',FieldName)-1) ELSE '' END COL2
FROM dbo.TableName
Output:
If above is still not working, please provide more sample data and expected output.
Thanks for your undertstanding.
Best regards
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.