Link to home
Start Free TrialLog in
Avatar of net-workx
net-workxFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Field Data Type To Store IP Address - MSSQL2000

I would like to know what data type to set on a field to store IP addresses so that i can run a query against it.

I have it set to nText at the minute but i obviously cannot put a query against this data type.

Regards,
Carl
SOLUTION
Avatar of imran_fast
imran_fast

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Why not varchar (or nvarchar)? (IP Address will only be a max of 15 characters)
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you are storing a port number as well, it could be longer ;)

5 characters for maximum port number, 1 for space (or colon).
So 21 characters if you are storing it, 15 if not.