• There are a ton of ways to do this but they all usually depend on certain things being there unless you happen to be pretty good at writing AI code. 😛

    Assuming that the only periods in the whole string will be a part of the IP address and the IP address will always be immediately followed by a colon, this is one of the simplest methods.

    --===== Setup the test. This is NOT a part of the solution.

    DECLARE @SomeString VARCHAR(8000);

    SELECT @SomeString = 'jdbc:inetpool:inetdae:10.25.81.123:17100?database=us_nnnn';

    --===== Demonstrate the solution which could be modified to work on a table column.

    SELECT SUBSTRING(PARSENAME(@SomeString,1),1,CHARINDEX(':',PARSENAME(@SomeString,1))-1);

    --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)