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

  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
    @iptonum varchar(15),@ip varchar(15)SET @ip=''select parsename(@ip,4)+right(('00'+parsename(@ip,3)),3)+right(('00'+parsename(@ip,2)),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?

Share This Page