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… .