cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

TRIM spaces for DB2 select

Sanssnap
New Contributor II

Hi, we are migrating DB2 tables into AWS Aurora MySQL database. I am using Generic JDBC select SNAP to select the data from the DB2 database .we had an issue with data migration for the DB2 char fields . The Char fields selected from DB2 has the trailing spaces, which are getting inserted into MySQL. Is there anyway we could trim the trailing space of all the fields without individually specifying it in MAPPER SNAP to TRIM the spaces. we have around 40 tables and some of the tables has more than 20 fields โ€ฆ Some of the tables Primary key fields are Char data type and is required to trimโ€ฆ
Please let me know if there is any solution or the specific settings in the SNAP to trim the selected data in simpler way

2 REPLIES 2

bojanvelevski
Valued Contributor

Try this:

$.mapValues((v,k)=> typeof v == 'string' ? v.trim() : v)

Sanssnap
New Contributor II

Wowโ€ฆThank you, bojanvelevski. The expression that you have suggested is workingโ€ฆ .