Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)

  • RE: Storing IPv4 Addresses for Performance

    I've always liked storing IP's as binary(4) - still 4 bytes, but simpler conversions:

    DECLARE @IpBin binary(4)

    DECLARE @IpString varchar(15)

    SET @IpString = '101.202.33.44'

    --convert string to binary

    SET @IpBin =CONVERT(binary(1), CONVERT(tinyint, PARSENAME(@IpString, 4)))

    + CONVERT(binary(1),...

  • RE: Map IP Address to a Geographical Location

    IP's fit much better in binary(4) than bigint - the conversion is pretty simple and cuts down heavily on reads and index size

Viewing 2 posts - 1 through 2 (of 2 total)