Skip to main content
1 of 4
Ario
  • 1.1k
  • 4
  • 14
  • 27

how find all position with patindex in

how find all position with patindex in tbale or variable?

declare @name nvarchar(max)
set @name ='ali reza dar yek shabe barani ba yek  dokhtare khoshkel be disco raft va ali baraye 1 saat anja bud va sepas... ali...'
select patindex('%ali%',@name) as pos 

up select return 1 but i want all results

    pos
   =====
    1
    74
    113
Ario
  • 1.1k
  • 4
  • 14
  • 27