Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 390
  • 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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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