I am using a piece of code to parse a number out of a string (and in most situations it works pretty good). I was under the assumption that each string would only have one number in it. I was wrong and every nowand then I run into a string with multiple numbers in it.Here is the original code:SELECT 'CQ_PROD' AS dbname, Left(SUBSTRING(program, PATINDEX('%[0-9.-]%', program), 8000), PATINDEX('%[^0-9.-]%', SUBSTRING(program, PATINDEX('%[0-9.-]%', program), 8000) + 'X')-1) AS Schema_VersionFROM CQ_PROD.DBO.scriptdefWHERE (program LIKE '%sub JAT_Version%')
These were the kinds of strings that I was parsing:Jat_Version { # Bunch of text ("Jumpstart Version 5.0"); } Jat_Version { # Bunch of text ("Jumpstart Version 5.0.1"); } Jat_Version { # Bunch of text ("Jumpstart Version 4.3"); }The query fails if the string has something like this:Jat_Version { # Bunch of text 1,2,3 some more text ("Jumpstart Version 5.0"); }Is there a quick way to tell my SUBSTRING line to start at the word "Jumpstart" (ignoring case) instead of the first character in the string. I think this would solve my issues.