CHARINDEX [0-9] with Redshift data
Answered
Hello, hoping someone can help me out. I'm been spinning my wheels on this for longer than I care to admit lol.
How do I write following to work? In SSMS (which I'm more used to), I would write the statement as the following but it isn't working. It doesn't seem to understand the [0-9]. I'm trying to return back the position where the first numeric character appears in the ID field. The ID's in my dataset can start with 2 to 4 alpha characters then end with 10 numeric digits. Is there another way to write a numeric range in Datagrip for Redshift data? Any help would be appreciated. Thanks!
SELECT ID
,CHARINDEX('[0-9]', ID)
FROM table
Please sign in to leave a comment.
@Dpaz
Try the function described in https://docs.aws.amazon.com/redshift/latest/dg/REGEXP_INSTR.html
More info about Redshift mathing conditions and string functions: