SQL Server Performance

Looking for function to convert ip/mac address to integer and vise versa

Discussion in 'General Developer Questions' started by RaymondXie, Sep 10, 2007.

  1. RaymondXie New Member

    1. Hello,

      Just wondering if anyone has function for converting IPv4 address and Mac address to integer? and vise versa? Thanks.
  2. Luis Martin Moderator

    http://www.justin-cook.com/wp/2006/11/28/convert-an-ip-address-to-ip-number-with-php-asp-c-and-vbnet/
  3. RaymondXie New Member

    Hi Luis,
    Thanks for your help. Do you happen to also have one for Mac address?
  4. Luis Martin Moderator

    Sorry, I can't find that.
  5. ranjitjain New Member

    I have used following method or way to convert ip to number
    declare
    @iptonum varchar(15),@ip varchar(15)SET @ip='10.5.25.255'select parsename(@ip,4)+right(('00'+parsename(@ip,3)),3)+right(('00'+parsename(@ip,2)),3)
    +right((
    '00'+parsename(@ip,1)),3)
  6. RaymondXie New Member

    Yes, this one is the simplest one, I saw that on other forum. Do you do Mac too? And how about vise versa?
    Thanks.

Share This Page