Solved

Field Data Type To Store IP Address - MSSQL2000

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

773 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