I need to extract a product #, which is in the URL. I figured most of it out but can't get one thing to work. The URLs are the format as below.
http://www.MyWebsite.com/p/Some-Text/-/A-31342578#Somevalue=Big_1_10
I need to extract the 31342578, which appears after the "A-" and ends at the "#". Below is the SQL that I have come up with this far.
Select URL SUBSTRING( ltrim(rtrim( substring( replace(cast(WL.URL as nvarchar(max)), '/', replicate(cast(' ' as nvarchar(max)),10000)), 60001, 10000))),0,CHARINDEX('#',ltrim(rtrim( substring( replace(cast(WL.URL as nvarchar(max)), '/', replicate(cast(' ' as nvarchar(max)),10000)), 60001, 10000))))) From tblWebLinks WLWith the above URL, this would return A-31342578. It's close but I need to remove the "A-". If anyone can offer me some assistance, I'd appreciate it. Thanks.