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.
精彩评论