SQLTeam.com | Weblogs | Forums

How to store IPV6 as bigint?


i want to

  1. store ipv6 as bigint
    2.check how many ip's between 2 ipv6 (after section 1)



IPv6 is a 128 bit address, bigint is a 64 bit integer representation. You won't be able to properly store it even with some kind of compression or interpolation unless you use 2 bigint columns. You could however using binary(16).


What is the length of your ipv6. and can you post a sample if you are able to. are you looking for some gaps?




@robert_volk - how do i convert them to and from binary? and how do i calculate gaps between them?