I know about text indexing, but this is different. I have 2 byte array columns in a table, labeled StartByteArray & EndByteArray. The Start column is a starting IP address in byte array form, and the same with the End column, except it is the stop IP. You can think of the high & low columns as boundaries of IP Addresses. It looks like this (just 10 rows shown):
StartIPAddress StartByteArray EndIPAddress EndByteArray
41.0.0.0 0x29000000 41.31.255.255 0x291FFFFF
41.32.0.0 0x29200000 41.47.255.255 0x292FFFFF
41.48.0.0 0x29300000 41.55.255.255 0x2937FFFF
41.56.0.0 0x29380000 41.56.255.255 0x2938FFFF
41.57.0.0 0x29390000 41.57.63.255 0x29393FFF
41.57.64.0 0x29394000 41.57.79.255 0x29394FFF
41.57.80.0 0x29395000 41.57.95.255 0x29395FFF
41.57.96.0 0x29396000 41.57.111.255 0x29396FFF
41.57.112.0 0x29397000 41.57.115.255 0x293973FF
41.57.116.0 0x29397400 41.57.119.255 0x293977FF
That's it. The reason I did this was to make searching for a row easier, if that row 'contained, or bounded, the given IP Address. Sounds harder than it is.
Put another way, I want to search for the row that my given IP Address (once also converted to byte array) is within.
Now writing the usual SQL is easy (example on SO here, for example), but I've got a feeling there is a clever way to index these columns in such a way that it will be efficient, but all I have done is text indexing, and there are 2 columns here that I'm doing math comparisons to, not letters of words over x characters long.
I'm using SQL Server 2012, and can also convert the data to anything better suited, as I own the DB.
Any thoughts?