howHow can I find all positionthe positions with patindexpatindex
in tbalea table or variable?
declare @name nvarchar(max)
set @name ='ali reza dar yek shabe barani ba yek dokhtare'
+ 'dokhtare khoshkel be disco raft va ali barayebaraye'
+ ' 1 saat anja bud va sepas... ali...'
select patindex('%ali%',@name) as pos
up select return 1 but i want all results
This returns 1
but I want all results, e.g.:
pos
========
1
74
113