• Mark (7/13/2009)


    I think both functions can be simplified

    create function dbo.ConvertIp2Num(@ip nvarchar(15))

    returns bigint

    as

    begin

    return ((cast(parsename(@ip,4) as bigint)*256+

    cast(parsename(@ip,3) as bigint))*256+

    cast(parsename(@ip,2) as bigint))*256+

    cast(parsename(@ip,1) as bigint)

    end

    That won't return the correct answer... the octets must be multiplied by powers of 256.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)