Skip to content
Advertisement

SQL Select after character /

I’d like to select everything AFTER a certain character (/) that is placed on the most right side.

I’v in CSV_COL(3) this text 200/100 or 50/10 ot 10/5 etc.. and i need to uso only number to the right of /

i try to use how i’ve found to forum

select right([CSV_COL(3)], charindex('/', reverse([CSV_COL(3)])) - 1)

But

Impossibile valutare l’espressione “select right(‘200/100’, charindex(‘/’, reverse(’20…”. Errore: “You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘select right(‘200/100’, charindex(‘/’, reverse(‘200/100′)) – 1)’ at line 1”

can anyone help me please? best regards

Advertisement

Answer

If you want the number after the last slash, you can use MySQL string function substring_index():

select substring_index(mycol, '/', -1)
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement