Return only part of the SQL field in the search

2

I wanted to return only the values that are in brackets in the table field in the query.

SELECT F2 FROM [dbo].[Vestcasa_Ranking_Produtos_Custo_]


F2
Airtom..(635)
paulo victo r.. (234) 
Antonio.. (459)

SEARCH THIS

635
234
459
    
asked by anonymous 06.10.2017 / 20:23

1 answer

2

Test this way:

Select
    SUBSTRING(F2,CHARINDEX('(',F2)+1 ,CHARINDEX(')',F2)-CHARINDEX('(',F2)-1)  
from 
    [dbo].[Vestcasa_Ranking_Produtos_Custo_]
    
06.10.2017 / 20:31