Solved

Field Data Type To Store IP Address - MSSQL2000

Posted on 2006-11-15
4
370 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
  • 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now