Skip to Content
0
Former Member
Aug 04, 2016 at 01:53 AM

BODS - Count the number of bytes of an input string

1735 Views

Hi,

How do I count the number of bytes of an input string? We've been going through a lot of String Data Right Truncate Error - SQLSTATE 2201 resulting to the data to be dumped into an overflow file. Take for example this data : NEUTROGENA RAINBATH® REVITALIZING SHOWER its 40 characters but 41 bytes, hence the error.

Number 1 option is not applicable, 2 last resort.

1.) Built in string function - LENGTH() counts the number of character only or have I missed any other function?

2.) Changing data type to vargraphic/nvarchar at DB - there's way too many tables affected

Any suggestion will be much appreciated. Thanks!

P.S. Will then use the bytes count in other program logic