Hi,
Code for String Manipulation... That is we can find out the Exact word in a continuous text using charindex.
declare @str as varchar(max)
set @str='fgjfkjgfkjgfgfdgfgf<input>TEXT</input>kjkjkjdfsdffagffhghghfdghg'
declare @startindex as int
declare @endindex as int
set @startindex = charindex('<input>',@str)+ len('<input>')
print @startindex
set @endindex=charindex('</input>',@str)
print @endindex
select substring(@str, @startindex , @endindex- @startindex)
select substring(@str, charindex('TEXT',@str), len('TEXT'))
Here we declare startindex and endindex using charindex. From these two indexes we can find the exact word from that sentence using substring.
Thanks, Sarav
|
No responses found. Be the first to respond and make money from revenue sharing program.
|