I am trying to get sub string till 2nd occurence of delimiter, but some how its not working. I followed several stackoverflow links:
SQL Server - find nth occurrence in a string
Here is the column in my database:
this+is+my
never+ending+movie
hello
Required output
this+is
never+ending
hello
I tried:
charindex('+', col1, (charindex('+', col1, 1))+1)
Error: SQL Error [500310] [42883]: Amazon Invalid operation: function charindex("unknown", character varying, integer) does not exist;
I am using Amzaon Redshift database and Dbeaver to connect.
CHARINDEX
differently, as indicated in the error message. The Redshift version does not include the third parameter, which the SQL Server code is trying to increment. – Eric Brandt