May 12, 2008 at 11:01 pm
Hi,
I would like to know how to separate a given URL into different parts like the given example below:
http:\\www.google.co.in\asdfdf\asdfasf?as234=234
fld1 fld2 fld3 fld4 fld5
http:\\http://www.google.co.inasdfdfasdfasfas234=234
Please help me to write a single query so that it will separate a given URL as shown.
With Regards
Dakshina Murthy
May 12, 2008 at 11:23 pm
Last half of the following article tells you how to do a "split". Just replace the ? with a \ in the URL, remove the first 7 characters, and do the split.
http://www.sqlservercentral.com/articles/TSQL/62867/
--Jeff Moden
Change is inevitable... Change for the better is not.
May 12, 2008 at 11:25 pm
If you really want it in a single query, create a function using the same technique. Your turn... why does it have to be in a single query?
--Jeff Moden
Change is inevitable... Change for the better is not.
May 22, 2008 at 8:55 pm
This is one situation where a CLR function would do the job nicely. It's got a nice URI object that exposes the various parts of a URL as properties - and if your parsing requirements are more complicated you can always use a RegEx...
Regards,
Jacob
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply