Parse string from URL between...

  • This simply keys off of the 1st not integer character following the start of the numeric sequence...

    It could also be easily converted into a very efficient iTVF...

    DECLARE @url VARCHAR(8000) = 'http://www.mydomain.info/Customer.aspx?h_hmid=2907831&dcc=EUR&mobiredirect=no&cpn=3790';

    SELECT

    LEFT(

    SUBSTRING(

    @url,

    CHARINDEX('hmid=', @url) + 5, 8000),

    PATINDEX('%[^0-9]%',

    SUBSTRING(

    @url,

    CHARINDEX('hmid=', @url) + 5, 8000)

    ) -1

    )

  • To add a bit more fun, what if

    DECLARE @url VARCHAR(8000) = 'http://www.mydomain.info/Customer.aspx?xxh_hmid=45678&h_hmid=2907831&dcc=EUR&mobiredirect=no&cpn=3790';

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply