dbTalk Databases Forums  

IP Management

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss IP Management in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John
 
Posts: n/a

Default IP Management - 02-23-2005 , 10:26 AM






I wanna save IP address in database in Int format.

Let's assume the ip is... 219.25.12.0

Can any one give me the idea like how I have to parse and save it into the
database in the int format and again parse for displaying in the origional
form.

Thanks in advance.




Reply With Quote
  #2  
Old   
Steve Thompson
 
Posts: n/a

Default Re: IP Management - 02-23-2005 , 11:08 AM






"John" <naissani (AT) hotmail (DOT) com> wrote

Quote:
I wanna save IP address in database in Int format.

Let's assume the ip is... 219.25.12.0

Can any one give me the idea like how I have to parse and save it into the
database in the int format and again parse for displaying in the origional
form.
I can give you some examples in VBScript if that helps?

Steve




Reply With Quote
  #3  
Old   
John
 
Posts: n/a

Default Re: IP Management - 02-23-2005 , 04:00 PM



Sure, can you give me?

Thanks

"Steve Thompson" <stevethompson (AT) nomail (DOT) please> wrote

Quote:
"John" <naissani (AT) hotmail (DOT) com> wrote in message
news:%23gUVJwbGFHA.3092 (AT) tk2msftngp13 (DOT) phx.gbl...
I wanna save IP address in database in Int format.

Let's assume the ip is... 219.25.12.0

Can any one give me the idea like how I have to parse and save it into
the
database in the int format and again parse for displaying in the
origional
form.

I can give you some examples in VBScript if that helps?

Steve





Reply With Quote
  #4  
Old   
Steve Thompson
 
Posts: n/a

Default Re: IP Management - 02-24-2005 , 11:02 AM



"John" <naissani (AT) hotmail (DOT) com> wrote

Quote:
Sure, can you give me?
I could not find a cleaner version that I had, so I wrote this... it doesn't
have any error checking, perhaps it will help.

?IP ("11.22.33.44")

Function IP(strIP)
Dim intPos
Dim IP1
Dim IP2
Dim IP3
Dim IP4
Dim IPAddress
Dim intLen
Dim intPeriod
Dim intPeriod2
Dim intPeriod3

IPAddress = strIP
intPos = 1
intPeriod = InStr(intPos, IPAddress, ".")
IP1 = Left(IPAddress, intPeriod - 1)
intPeriod2 = InStr(intPeriod + 1, IPAddress, ".")
intPeriod3 = InStr(intPeriod2 + 1, IPAddress, ".")
IP2 = Mid(IPAddress, intPeriod + 1, (intPeriod2 - intPeriod - 1))
IP3 = Mid(IPAddress, intPeriod2 + 1, (intPeriod3 - intPeriod2 - 1))
IP4 = Right(IPAddress, Len(strIP) - intPeriod3)
Debug.Print IP1
Debug.Print IP2
Debug.Print IP3
Debug.Print IP4
IP = IPAddress
End Function




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.