Solved

Field Data Type To Store IP Address - MSSQL2000

Posted on 2006-11-15
4
380 Views
Last Modified: 2010-08-05
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
Comment
Question by:net-workx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 28

Assisted Solution

by:imran_fast
imran_fast earned 500 total points
ID: 17946923
No set it to varchar(50)
0
 
LVL 29

Expert Comment

by:Nightman
ID: 17946930
Why not varchar (or nvarchar)? (IP Address will only be a max of 15 characters)
0
 
LVL 28

Accepted Solution

by:
imran_fast earned 500 total points
ID: 17946942
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
 
LVL 29

Expert Comment

by:Nightman
ID: 17946986
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question