[thechat] even more quatsch

Joe Crawford jcrawford at avencom.com
Fri May 17 13:16:00 CDT 2002


rudy wrote:

> 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


I'd be looking for something like JavaScript's split() function - which
works like this:

ipAddy = "123.456.4.12";
a = ipAddy.split('.');

which would give you an array like this:

a[0] = 123;
a[1] = 456;
a[2] = 4;
a[3] = 12;

is there any such thing/function in SQL?

> 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


or do a view of the ip address table and push them into columns as
numerics? something like that?

just spitballing here.


> 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


this surely must be something that's been thought of by database gurus.
must be someone tackled this...

> open to any other brilliant flashes of insight


how about nonsense like mine. :-)

> offlist, if desired


heck no! i want to <tip> on thechat.

	- Joe

<tip>
If you're ever in Los Angeles, and you have a hankering for a classic
hot dog. Get yer ass down to Pink's - a classic, greasy, chili-laden
tradition - world famous and in Hollywood itself.

My appetite has been terrible lately. (Psychosocial angst is great for
weight loss!) But I could really go for one of their big ol' dogs -
laden with onions and sauerkraut and chili.

And even fries. I don't usually, but I think I'd splurge for a Pink's dog.

(note to self: I probably have lots of positive associations with Pink's
because Jenny and I used to go there. Also, we saw Puck (of MTV's Real
World fame) at Pink's once. Leading to our joke-to-ourselves catchphrase
-- "I saw Puck at Pink's!" -- which is amazingly fun to say repeatedly.
</tip>




More information about the thechat mailing list