Discard trailing spaces in char field

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
abhilashnair
Participant
Posts: 284
Joined: Fri Oct 13, 2006 4:31 am

Discard trailing spaces in char field

Post by abhilashnair »

Source DB2(ODBC Enterprise)---->Transformer------->Target SQL Sever(ODBC Enterprise)

The incoming field is Char(3). Target also it is Char(3)
Spaces are being added to end while writing to target. I used Trim in transformer. No change. I tried Convert(). No effect. Any suggestion. Ineed only actual value in target without trailing space

APT_STRING_PADCHAR is set to 0x0 at project level
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It's a char field... that's how they work. Everything is fine.
-craig

"You can never have too many knives" -- Logan Nine Fingers
abhilashnair
Participant
Posts: 284
Joined: Fri Oct 13, 2006 4:31 am

Post by abhilashnair »

But as per requirement, need to do away with those trailing spaces...If I define target metadata as varchar, it works..Is this a good idea? Is there any other way?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your requirements are bad for a CHAR. If your database target was a varchar, then yes you could 'discard trailing spaces' easily.
-craig

"You can never have too many knives" -- Logan Nine Fingers
abhilashnair
Participant
Posts: 284
Joined: Fri Oct 13, 2006 4:31 am

Post by abhilashnair »

chulett wrote:Your requirements are bad for a CHAR. If your database target was a varchar, then yes you could 'discard trailing spaces' easily. ...
The problem is that the downstream apps which use the sql server target table are facing issues while querying. The field is Char in target as well, but DataStage is appending null at the end which is being picked up as a special character in sql server. I think if I use Varchar the issue will be resolved. Do I need to change APT_STRING_PADCHAR value...currently it is 0x0
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, you need to change APT_STRING_PADCHAR to a space: 0x20
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply