cancel
Showing results for 
Search instead for 
Did you mean: 

Query for SAP HANA

arsalkhan909
Explorer
0 Kudos

Dear Experts,

I am seeking assistance to formulate Query for SAP HANA to extract items that specifically shows only the number with 'yds' from the given item name. For Example "Panda 70mm x 280yds 38mic Standard Clear"

Accepted Solutions (1)

Accepted Solutions (1)

Cocquerel
Active Contributor

You can use function SUBSTR_REGEXPR for this.

For example, the following statement will return 280

SELECT SUBSTR_REGEXPR('([0-9]+)(yds)' IN  'Panda 70mm x 280yds 38mic Standard Clear' GROUP 1) FROM DUMMY

See more info here https://help.sap.com/docs/SAP_HANA_PLATFORM/4fe29514fd584807ac9f2a04f6754767/a2f80e8ac8904c13959c69b...

arsalkhan909
Explorer
0 Kudos

Thank you for your assistance.

I applied the same statement for 'mm,' and it returned 70. However, when I used this statement on the string "Panda 11.5mm x 280yds 38mic Standard Clear," it returned only 5 after the decimal point instead of the expected "11.5."

Cocquerel
Active Contributor
SELECT SUBSTR_REGEXPR('([\d\.]+)(mm)' IN  'Panda 11.5mm x 280yds 38mic Standard Clear,' GROUP 1) FROM DUMMY

returns 11.5

Answers (0)