Page 1 of 1

Numeric value issue

Posted: Tue Jun 19, 2012 4:36 pm
by rsunny
Hi,

I am trying to generate a unique sequence number and appending that value to a string and the data type of that column is varchar.
For example the value would be 'ABC_123', but for my scenario the value is populating as 'abc_7.61778e+06' instead of 'abc_7617780'

Can you please help me to get the solution as i tried using stringToDecimal but didnt work.

Posted: Tue Jun 19, 2012 4:47 pm
by chulett
An exact search here for "scientific notation" might prove helpful.

Posted: Tue Jun 19, 2012 8:25 pm
by rsunny
Hi craig,

I did a search on "scientific notation" but couldnt able to find a solution.

One solution i have in my mind is for example if i am getting the value as 7.61778e+06 then i can take the number before 'e' and multiply by 10 and the number after + which is '6' i.e 7.61778*10*06.

Can you please provide me a better solution if there is any other alternative solution.
And what would be the reason of getting a value as abc_7.61778e+06 of datatype as Varchar.
Is it because before the number there is a string , so it converts the value into abc_7.61778e+06 instead of 'abc_7617780'

Posted: Tue Jun 19, 2012 8:38 pm
by mobashshar
Have you tried Concatenating the unique seq numeric value to varchar field?

Posted: Tue Jun 19, 2012 8:48 pm
by rsunny
yes my value will be 'abc_uniqueseqnumber

Posted: Tue Jun 19, 2012 9:48 pm
by jwiles
Try a different datatype for the number you are generating (would I be correct if I guess you have it defined as a float or double-float?)

Regards,

Posted: Thu Jun 21, 2012 11:24 am
by rsunny
Hi,

Can you please provide me the solution as i need to use the datatype as Varchar . If i use the datatype as Integer it works but i nmeed to use the datatype as Varchar . And if i use Varchar i am not able to generate the number

Posted: Thu Jun 21, 2012 11:35 am
by chulett
So "use" it as an Integer and then convert it to a string before you concatenate it to your other varchar.

Posted: Thu Jun 21, 2012 1:16 pm
by jwiles
How do you currently generate the sequence number? A stage variable which you then concatenate to the other string before output? That stage variable should be an integer or big integer.

Regards,