开发者

Best Practice Storing & Comparing IP Addresses

what's the best practice with storing IP Addresses in a database. (sql server)

I don't plan on doing any major work using IP's , I just want to compare it to last logged IP Address etc.

Would jus开发者_运维问答t storing it as a string be sufficient as this should cover IPv6 also?


If you are only going to compare IP addresses to each other and nothing more (i.e. not analyzing things like breakdown by IP block), then strings should be fine.

For IPv6 ensure the field length is no less then 39 characters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜