[thechat] even more quatsch

rudy rudy937 at rogers.com
Fri May 17 12:22:07 CDT 2002

>> got a really tough sql query to write (sort IP numbers
>> using sql functions to split out the four groups of digits)
> Convert it all to binary.

yeah, offtopic for this list, but thanks for the interest, joel

the IP number is a string, and the tough part is finding the three periods
in there, and then pulling out the four groups of digits

once that's done, i suppose you could cast them as numerics and do the
conversion, but it's just as easy to pad them with zeroes on the left and
sort by four groups of 3-character strings

in sql/server, there's the charindex function which you can use to find the
first period, and then charindex(ipno,'.')-1 gives you the last character to
pull out the first substring (first group of 1 to 3 digits), but by the time
you're pulling out the fourth group of digits, you've got charindexes nested
up the yingyang

open to any other brilliant flashes of insight

offlist, if desired


More information about the thechat mailing list