If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Including/Comparing massive amount of locations to ip-adresses in SQL Query. ??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-27-04, 10:46
Mirador Mirador is offline
Registered User
 
Join Date: Jan 2004
Location: Oslo
Posts: 45
Arrow Including/Comparing massive amount of locations to ip-adresses in SQL Query. ??

Well.. here i am again with another buggy question....

Using a traffic counter which are using SQL DB for storing unique IP's.
Now i got this MASSIVE list of locations which got different ip-ranges.

What i basically need, is assistance with how to do this in the best way.
I have to include it in the SQL query so that the last <td> is displaying the correct location for the ip-address.. (which means is between the ip-range ex : 162.156.72.000 and 162.156.73.000)

The whole net got the same first 2 parts of the ip : 162.156.XXX.XXX, but the 2 last parts will ofcourse vary.

I'm not sure how to do this the best way, since there's about 100 different ip-ranges, so therefore maybe 100 "if, then, else if's" or "Case"'s ?

Might be a much better way but cannot figure out a better way though..
Developed in A.S.P. btw..

Can anyone enlighten me on this ?

------------------ WANNA-BE CODE --------------------
ipLocation = IF fieldname BETWEEN 162.156.72.000 AND 162.156.73.000 THEN "Stockholm" IF fieldname BETWEEN etc.etc.etc..
------------------------------------------------------------

Best regards
Mirador
Reply With Quote
  #2 (permalink)  
Old 01-27-04, 11:32
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: Including/Comparing massive amount of locations to ip-adresses in SQL Query. ??

Sounds like you need another table, which stores the location name for each IP or IP range. Then just join to that.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On