Char to Varchar convert

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Char to Varchar convert

Post by snassimr »

Hi !

If any way to convert char to varchar inside DS ?
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Re: Char to Varchar convert

Post by DeepakCorning »

You can use CAST from char to varchar.Its not a DS function but a DB (oracle ) function.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Every Char is VarChar (if needed) within DataStage server edition.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Post by snassimr »

I need to read char ( in column metadata) as varchar from database
and get warning So its not the same for DS
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It IS the same in DataStage. However the metadata in your DataStage job design are used to communicate with the database server, which is the origin of your metadata mismatch warnings. But you can take that Char column and direct it across a Transformer stage into a VarChar with no derivation expression other than the input column.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi,
If your soruce is sequential file and target is RDBMS, you can try reading the source it self as varchar.
It shouldnt prompt you a warning.

regards
kumar
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Post by DeepakCorning »

Hey Ray,

One doubt on this one. So if my target is varchar then in DS i just need to map it from char to varchar and the conversion will happen automatically??
I mean to say I have to map a char to varchar then i need not put any function but just map it from char to varchar . right??
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi,
I guess Ray made it clear, it can be converted without any warning but in transformer.

regards
kumar
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

As I said, "you can take that Char column and direct it across a Transformer stage into a VarChar with no derivation expression other than the input column". There is no error. There is no CAST required.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply