nv-l

[nv-l] Re: ip_address convertion in MSSQL[NetView for NT]

2002-05-28 05:50:56
Subject: [nv-l] Re: ip_address convertion in MSSQL[NetView for NT]
From: cfrantse AT csc DOT com
To: nv-l AT lists.tivoli DOT com
Date: Tue, 28 May 2002 11:50:56 +0200
Some options

Use an SQL function
I don't know if there exists one in MSSQL, I know MySQL has one called
inet_ntoa() that converts decimal to IP


Create your own SQL function
I have some PostgreSQL functions I made, if you want them just let me know.


Use Perl or some other script language to do the conversion
I use the following with Perl:
# Convert decimal to IP
my $dec = 13018098;
my $ip = join(".", unpack("C4", pack("N", $dec)));

# Convert IP to decimal
my $ip = 1.1.1.1;
my $dec = unpack("N", pack("C4", split(/\./,$ip)));



-------------------------------------

Hi lists ;-)

I have a question at Tivoli NetView for NT

On MSSQL database's table,
In ipAddress field,there are filled with integer something like 32372939
I'd like convert 32372939 to xxx.xxx.xxx.xxx
How can I convert interger to IP address? There's a rule to resolving that?

Thanks In Advance..



Christian Frantsen
CSC, Computer Sciences Corporation
Jonkoping, Sweden

"I don't need to test my programs. I have an error-correcting modem."


<Prev in Thread] Current Thread [Next in Thread>
  • [nv-l] Re: ip_address convertion in MSSQL[NetView for NT], cfrantse <=