ipaddressrange icon indicating copy to clipboard operation
ipaddressrange copied to clipboard

Recommended SQL Server data type?

Open mwoffenden opened this issue 7 years ago • 1 comments

What is the recommended SQL Server data type for use with this to store IP addresses?

mwoffenden avatar Jun 21 '18 19:06 mwoffenden

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.

manigandham avatar Feb 12 '19 21:02 manigandham