Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 IPv6 Storage

Author  Topic 

Blastrix
Posting Yak Master

208 Posts

Posted - 2004-02-27 : 18:52:03
How is everyone out there handling IPv6 storage? I had originally thought IPv6 was 64 bits, and was just going to use a bigint, but after checking the specification, I found out that it's 128 bits. I would prefer to store the IPs in their broken down numerical form for faster querying, but am not quite sure what to do. Should I just use varbinary?

Thanks,
Steve

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-02-28 : 14:02:40
You could, but frankly it's probably better to use varchar. The reason is that IPv6 has some shorthand notation that allows for repeating zero octets (1:1:0:0:0:0:0:128) to be referenced as (1:1::128), and you'll have a lot more trouble parsing that than it's probably worth. And even though it can be converted to a number, an IP address is NOT a number, nor will it ever be presented as one, or in a binary form.

You can always use computed columns that parse out each octet, and in SQL Server 2000 you can index those computed columns as well. You could use regular columns too if you can afford the space. If you go with the latter, I'd recommend having them parsed outside of SQL Server and passed in as separate variables to be inserted, instead of parsing them in T-SQL.
Go to Top of Page
   

- Advertisement -