Using PATINDEX to find varying length patterns in T-SQL

后端 未结 6 2141
旧时难觅i
旧时难觅i 2020-12-19 01:20

I\'m looking to pull floats out of some varchars, using PATINDEX() to spot them. I know in each varchar string, I\'m only interested in the first float that exists, but they

6条回答
  •  醉话见心
    2020-12-19 02:02

    Wildcards.

    SELECT PATINDEX('%[0-9]%[0-9].[0-9]%[0-9]%','some text 456.09 other text')
    SELECT PATINDEX('%[0-9]%[0-9].[0-9]%[0-9]%','even more text 98273.453 la la la')
    

提交回复
热议问题