Max
Max

Reputation: 538

Substring from an escape character onwards

I'm using PostgreSQL and I need to truncate a text string, I need to show from an escape character (:) onwards.

I'm trying something like that:

  SELECT SUBSTRING ('CATEGORIA DE TRABAJOS: EJECUTIVO' FROM '%#":#"%' FOR '#'); 

Upvotes: 1

Views: 294

Answers (1)

Vao Tsun
Vao Tsun

Reputation: 51406

t=# select split_part('CATEGORIA DE TRABAJOS: EJECUTIVO',':',2);
 split_part
------------
  EJECUTIVO
(1 row)

just split by first found delimiter?..

Upvotes: 1

Related Questions