How to split sql variable by 2
4 answers
Brute force grinding an 80-digit value at position 40 risks breaking in the middle of a word. Instead, you can do the following:
- Replace all spaces with spaces with one space.
- Find the last space at position 40 or below.
- Put everything up to that space in the first result box.
- Put everything after that space in the second field of the result.
The exact details of the above operations will depend on what tools are available to you (for example, SQL only, or reading from one database and writing to another using a separate program, etc.)
There is a possibility that an 80-digit value could be filled in such a way that a gap between words would cause one of the result values ββto be more than 40 characters long to avoid truncation.
0
source to share