Friday, July 5, 2013

CharIndex



select charindex('an','madhsan')
--output
6
select charindex('an','madhsan',1)
--output(as it searches from 1st character)
6
select charindex('an','madhsan',7)
--output (as it searches from 7nth characters)
0


select patindex('%an%','madhsancoolan')
--output (Patindex is charindex plus wildcardsearch)
6

No comments:

Post a Comment