Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

SQL Selecionar valores entre parênteses


CHARINDEX irá ajudá-lo Referência
declare @temp table        
(val nvarchar(77))

insert into @temp values ('SSS Pensioner Loan (C000000001)')
insert into @temp values ('SSS SSS Loan (C000000002)      ')
insert into @temp values ('SSS Salary Loan (C000000007)   ')
insert into @temp values ('SSS PAGIBIG Loan (C000000003)  ')



SELECT 
SUBSTRING(val,CHARINDEX('(', val) + 1,CHARINDEX(')', val) - CHARINDEX('(', val) - 1) as Val
from @temp