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

Hi,

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

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/8cd18f69-1926-42e8-ab62-4c90c1190b00/2nd-position-in-a-string?forum=sqlgetstarted