Get Value from Url

Hi,
i want to get the num-Value between the 2 Delimiters (h_hmid - and the End of the numeric Value)
in this case: 2907831 (var len of Value !)
What is the fastest way, to get all Values from a big Table? Is there a Index on this Column suggest ?

Example:
http://www.mydomain.info/Customer.aspx?h_hmid=2907831&dcc=EUR&mobiredirect=no&cpn=3790

Thanks
Regards
Nicole

You could use CHARINDEX to locate the key strings ("h_hmid=" and "&") , then use SUBSTRING to extract the numeric portion and then use CAST or CONVERT to put it into a number. An index, however, won't be of assistance with any of that. HTH

declare @s varchar(max) = 'http://www.mydomain.info/Customer.aspx?h_hmid=2907831&dcc=EUR&mobiredirect=no&cpn=3790';

select substring(@s, charindex('h_hmid=', @s) + 7, charindex('&', @s, charindex('h_hmid=', @s)) - charindex('h_hmid=', @s) - 7)