Answer the question
In order to leave comments, you need to log in
Is it possible to cut a string in Select if it exceeds the specified number of characters?
Select id, name, text From Texts
Is it possible to truncate "Texts.text" if it is more than 50 characters and add "..." to it?
Answer the question
In order to leave comments, you need to log in
select
case
when char_length(some_field) > 15 then substring(some_field from 0 for 15) || '...'
else some_field
end
from some_table;
Can.
IF ... THEN
char_length, substring
If length is greater than 50, take the first 47 and add "...".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question