I've used this before for parsing IP Addresses as suggested.
Re-reading the article today made me realize that I can use it in more ways, and what took me a few hours to do in C# yesterday was replaced in a half hour today.
The scenario I had was checking URLs to see if they matched an /x/{name}/{id} pattern and convert them to an updated pattern swapping the names and id. Using ParseName I passed it in and then did an isnumeric on element1 and if so then check the tables to see if the id existed and if so return the proper format.
Thank you,
Mike
Mad Myche (3/19/2014)
I've used this before for parsing IP Addresses as suggested.Re-reading the article today made me realize that I can use it in more ways, and what took me a few hours to do in C# yesterday was replaced in a half hour today.
The scenario I had was checking URLs to see if they matched an /x/{name}/{id} pattern and convert them to an updated pattern swapping the names and id. Using ParseName I passed it in and then did an isnumeric on element1 and if so then check the tables to see if the id existed and if so return the proper format.
Thank you,
Mike
That's great Mike. Glad you were able to make immediate use of it!
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Very good article well written and logical. Learned something new and can think of immediate use for it!! Thank you
...
Nice article. Really like combining it with the REPLACE function.
Excellent article.
Typically I'd just use the delimitted splitter to break the string up, and then figure out a way to put it all back together somehow.
For smaller strings of a limitted number of delimiters I need to parse, this is pretty cool, shame it doesn't handle more than a 4 part string though... if it just parsed out strings to N delimiters, I think it would get even more use.
Nice article. May come in use one day so glad you shared that.
Btw, I use bigint to store IP4 addresses (less space and able to use ORDER BY)
thierry.vandurme (1/15/2016)
Nice article. May come in use one day so glad you shared that.Btw, I use bigint to store IP4 addresses (less space and able to use ORDER BY)
It'll be interesting how you pick parts of the address out during a search.
If you really want to save some space, separate each octet out into a separate TINYINT column. That takes only 4 bytes total, is sortable, and is searchable without having to jump through hoops.
--Jeff Moden
Change is inevitable... Change for the better is not.
Great article. As you illustrate with phone numbers, I use it with REPLACE in our organization to handle GL account numbers.
Don Simpson
Viewing 15 posts - 1 through 15 (of 37 total)
You must be logged in to reply to this topic. Login to reply