How can I find all the positions with patindex
in a table 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
This returns 1
but I want all results, e.g.:
pos
===
1
74
113