• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 393
  • Last Modified:

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
0
net-workx
Asked:
net-workx
  • 2
  • 2
2 Solutions
 
imran_fastCommented:
No set it to varchar(50)
0
 
NightmanCTOCommented:
Why not varchar (or nvarchar)? (IP Address will only be a max of 15 characters)
0
 
imran_fastCommented:
the ip address will be in format
10.64.62.105

maximum
xxx.xxx.xxx.xxx

maximum 15 character so better make it varchar(15) or varchar(20)

Regards
Imran
0
 
NightmanCTOCommented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now