What happens when varchar is mapped to char, look at the ex.

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
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

What happens when varchar is mapped to char, look at the ex.

Post by zulfi123786 »

For example:

A field 'ID' is Varchar(10) and having a value "abc", if this field is directly mapped to "IP_ID" char(10) in a transformer, would it append 7 spaces to "IP_ID".
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

A CHAR field is fixed-width. It will pad to the specified length with whatever is defined in $APT_STRING_PADCHAR. It defaults to 0x0 I think... use 0x20 to pad with spaces.

Mike
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

chulett wrote:Yes. ...
If i don't specify the length while reading the sequential file, even then would it do the same?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ah... forgot about the PADCHAR variable and the fact you can control it inside your job. So, the default is to pad with "nulls"? :?
-craig

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