Problem with BIT as SQL type

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
fyaqq
Participant
Posts: 43
Joined: Thu Aug 31, 2006 5:05 pm

Problem with BIT as SQL type

Post by fyaqq »

the input is a table in the sql server. A field is a bit (0 or 1).
the output is a sequential file. In the transformer stage, I set the corresponding output field's SQL type also be BIT.
The problem is when I view the output seqential file, I saw 1 in the sql server database table became -1 in the sequential file.
What did I miss here? I know I can manually get the right number by -1.
Just curious what's going on behind it.
Thanks.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The bit datatype uses the most significant bit in its byte. This is the sign bit. In a twos-complement machine the bit pattern 10000000 represents -1. There's nothing you can do about that. Why not apply the Abs() function?
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