Find the position of nth occurrence of a character in a string


I have a scenario where I need to extract a string from the nth occurrence of character (say “/”) till the first space of the string.

For eg
String → 12/28/21 11:14:12

need to extract 21.

Is there a way I can find the position of second occurrence of “/”?

Here I have given date as an example. but it could be a text field as well.

Hi @Sumithra You probably need to right a SQL, I see an example from Microsoft but CHARINDEX is not supported by Dremio. If the backend is a RDBMS, you can use native functions of the RDBMS using Dremio External Query