April 30, 2008 at 8:55 am
Casting to an INT should actually run a bit faster over a large number of rows.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 30, 2008 at 9:03 am
yeah,
I have a table of called tbl_Router_details with stuff like IP, subnet, etc,
another table with router configs,
another table with router locations etc
these are all inner joined.
When I write out all the data to an ASP, I have the headers as clickable events that order by that column, on each click, i've written it to build a new query based on what the sort order needs to be by,
Now for the fun bit, :o)
I'm going to write a function in a DLL to telnet the routers and upload / download the configs and store in a separate table.
July 16, 2009 at 12:02 am
hi
IP address (IPV4) is divided into four sub-blocks. Each sub-block has a different weight number, each powered by 256. The IP number is being used in the database because it is efficient to search between a range of numbers in the database.
The beginning IP number and the ending IP number are calculated based on the following formula:
Collapse
IP Number = 16777216*w + 65536*x + 256*y + z (1)
where:
Collapse
IP Address = w.x.y.z
For example, if the IP address is "202.186.13.4", then its IP number is "3401190660" based on the above formula.
Collapse
IP Address = 202.186.13.4
So, w = 202, x = 186, y = 13 and z = 4
IP Number = 16777216*202 + 65536*186 + 256*13 + 4
= 3388997632 + 12189696 + 3328 + 4
= 3401190660
To reverse the IP number to the IP address:
Collapse
w = int ( IP Number / 16777216 ) % 256
x = int ( IP Number / 65536 ) % 256
y = int ( IP Number / 256 ) % 256
z = int ( IP Number ) % 256
you can get the ip address and also the number format geo location from ip-details.com[/url]
July 19, 2009 at 10:07 pm
That's cool... so, are you suggesting a method sort IP addresses that aren't necessarily in the 3 digit byte format?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply