ipaddressrange
ipaddressrange copied to clipboard
Recommended SQL Server data type?
What is the recommended SQL Server data type for use with this to store IP addresses?
Single addresses? IPv4 can be stored as integers (since that's what they are). Otherwise, or if you need IPv6, use binary to store the raw bytes or varchar to store as a string.
If you need ranges then there's no easy way. Simplest would be to store the max and min values separately, and the range too as a string just in case.