SQLTips

How to truncate a string intelligently

substring(text from 1 for (110 - length(substring_index(substring(text from 1 for 110),' ', -1)))) as text

will strip until the last word, which competely fits into less than 110 chars. No truncating in the middle of words or even worse, entities.

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
These projects are supported by Liip AG