mickyT (11/3/2013)
HiHaving another look at your query, the points you are creating for the fact table are in a straight line on a zero y coordinate, unless you are creating a point with zero height.
FROM #fact_table ip
LEFT JOIN GEO2IP tr ON geo_range.STWithin(geometry::STGeomFromText(
'POINT('+CONVERT(varchar(20),ip.IP_Converted)+' 0)',0)) = 1
So when you build a point it will look something like POINT(2155.21 0), this may be part of your problem.
Can you give us an example of a point that you are querying with and a geo_range from your geo2ip table
SELECT TOP 1 geometry::STGeomFromText('POINT('+CONVERT(varchar(20),ip.IP_Converted)+' 0)',0).ToString() FROM #fact_table;
SELECT TOP 1 geo_range.ToString() FROM geo2ip;
Yes, that's intentional. The geometry built from the IP ranges are LINESTRINGs so there is no height
Here's kind of a quick rundown on how the tables are structured:
@hugo, thanks for the huge post full of information. I am reading through and will post a response once I organize my thoughts.