Page 1 of 1

Implicit conversion

Posted: Fri Sep 10, 2010 7:42 am
by jpraveen
Hi

Length precosion
source1 column
HOSP_NUM int 4 10


source2 column
PRVDR_FAC smallint 2 5




Target column
PRVDR_FAC smallint 2 5


I am using Lookup on 2 source columns (HOSP_NUM,PRVDR_FAC) and these are different types(int,smallint) and target is(PRVDR_FAC-smallint )
i am getting the error
When binding output interface field "HOSP_NUM" to field "HOSP_NUM": Implicit conversion from source type "int32" to result type "int16": Possible range limitation.
i had changed the Lenghts in between the stages but it's not working.

Posted: Fri Sep 10, 2010 8:20 am
by ArndW
If you add $OSH_PRINT_SCHEMAS = true to your job parameters you can see the actual schema used between your stages. You are converting HOSP_NUM to a datatype with less possible value and thus you are getting the warning message. The best solution is to explicitly convert the data to the same types in your job to avoid this message.

Posted: Fri Sep 10, 2010 10:19 am
by FranklinE
ArndW wrote:If you add $OSH_PRINT_SCHEMAS = true to your job parameters you can see the actual schema used between your stages. You are converting HOSP_NUM to a datatype with less possible value and thus you are getting the warning message. The best solution is to explicitly convert the data to the same types in your job to avoid this message.
A request for a more general discussion of the fact that the only place in Designer that one can code explicit conversions is the Transformer stage. When I see suggestions like yours, my first reaction is to shudder at the thought that some jobs will be full of Transformers just to avoid warning messages. :?

Posted: Fri Sep 10, 2010 6:03 pm
by ray.wurlod
Of course this alert will be generated. You have an int (that is, int32) in source1 and you're specifying that it should be transferred to a smallint (that is, int16) in the target. It's got nothing at all to do with length. int32 is a four-byte (binary) integer, int16 only has two bytes. There are int32 values that simply can not be loaded into an int16 field. That's why the alert is generated. If the source only contains int16s, alter the metadata appropriately.

Posted: Mon Sep 13, 2010 1:38 am
by jpraveen
HI all

so i need to change the Datatype by using Modify stage or is there any other option.

Posted: Mon Sep 13, 2010 3:51 am
by ray.wurlod
Transformer stage.
Copy stage. (You will still get the warning.)
Modifying the source metadata.