0

I have an attribute that contrains names delimited with ',' like "Sylvain GASNIER,Mickaël BENOIST,ect...," I would like to have in result

Sylvain GASNIER
Michaël BENOIST
..
..

The idea is to test if a name exists in the first string, so I split the names then check.

this how I did but I get just the first name.

select 
       substring(TITULAIRE,1,CHARINDEX(',',TITULAIRE)-1 )
from dbo.DATA_ACTIONS
WHERE TITULAIRE LIKE 'Sylvain GASNIER,Mickaël BENOIST' and CHARINDEX(',',TITULAIRE) > 0; 

I would like to do it in a procedure

Jaydip Jadhav
  • 12,179
  • 6
  • 24
  • 40
unfoudev
  • 87
  • 1
  • 7
  • 5
    are you banned in google? http://stackoverflow.com/questions/2647/how-do-i-split-a-string-so-i-can-access-item-x – xdd Jun 24 '16 at 12:18
  • not banned but I don't find one easy to undestand – unfoudev Jun 24 '16 at 12:25
  • I would recommend reading Aaron Bertrand's answer instead of the accepted answer in the duplicate question. Using loops to split strings is horribly inefficient. – Sean Lange Jun 24 '16 at 13:12

0 Answers0