To get a specific string from a string column
First you need to get the starting position of your string by CharIndex like:
CHARINDEX('https:',FeedBody,1)
Then you need to get the ending position of your string like:
CHARINDEX('?AWS',FeedBody,1)
Now you have to Use SUBSTRING function to find your desired string by giving the starting and ending point in it which you get from CHARINDEX. like:
select
SUBSTRING(FeedBody,CHARINDEX('https:',FeedBody,1),CHARINDEX('?AWS',FeedBody,1)-CHARINDEX('https:',FeedBody,1))
from
feeds
CHARINDEX('https:',FeedBody,1)
Then you need to get the ending position of your string like:
CHARINDEX('?AWS',FeedBody,1)
Now you have to Use SUBSTRING function to find your desired string by giving the starting and ending point in it which you get from CHARINDEX. like:
select
SUBSTRING(FeedBody,CHARINDEX('https:',FeedBody,1),CHARINDEX('?AWS',FeedBody,1)-CHARINDEX('https:',FeedBody,1))
from
feeds
Comments
Post a Comment