Page 1 of 1

Remove leading dot in the decimal value of fixed length

Posted: Thu May 18, 2006 1:24 am
by spendem
Hi All,

I want to remove the leading "." i.e dot in the decimal value.

Example: Input is date(10) = 2005-05-18 after coverting the date to decimal
Output is Decimal(8) = 20050518.

My requirement is to get Decimal(8) = 20050518 i.e I want to skip the . (dot) value.

I tried using trim function and even tried reading the output in Char and Varchar data type but didn't work out.

Can anyone please help me out on how to achieve this in Enterprise Edition.


Many Thanks,
Spendem

Posted: Thu May 18, 2006 2:20 am
by mandyli
Hi Spendem

try following one

[b]Trim("20050518.", ".", "A")[/b]


I hope it will give correct result..


Thanks
Man

Posted: Thu May 18, 2006 2:26 am
by ray.wurlod
The dot may not actually be there. It may be an artifact of the data browser. Does the dot get through to your target? If so, convert its data type to int64 or uint64 and the dot will vanish.

Posted: Thu May 18, 2006 3:16 am
by spendem
Hi,

Thanks for the answers,
Mandiyil what is ? I tried using it I am getting a validation error.

Ray,
If I m using BigInt or Integer(64) The preecing zeros seems to dissapear for Numeric field.

Is there any other round?

Many Thanks,
Sandeep

Posted: Thu May 18, 2006 3:33 am
by mandyli
Hi


i am sorry pls try following one. try Ray suggested way also.

Trim("20050518.", ".", "A")


Man

Re: Remove leading dot in the decimal value of fixed length

Posted: Thu May 18, 2006 6:16 am
by mspanda
Hi
i hope the following line helps you to get your required output

Ereplace("2005-05-18 ","-","")

Thanks
-Mspanda


spendem wrote:Hi All,

I want to remove the leading "." i.e dot in the decimal value.

Example: Input is date(10) = 2005-05-18 after coverting the date to decimal
Output is Decimal(8) = 20050518.

My requirement is to get Decimal(8) = 20050518 i.e I want to skip the . (dot) value.

I tried using trim function and even tried reading the output in Char and Varchar data type but didn't work out.

Can anyone please help me out on how to achieve this in Enterprise Edition.


Many Thanks,
Spendem

Posted: Thu May 18, 2006 2:33 pm
by ray.wurlod
spendem wrote:If I m using BigInt or Integer(64) The preecing zeros seems to dissapear for Numeric field.
Leading zeroes are not relevant for integer data types. Your original question made no mention of any need to preserve leading zeroes. You can add leading zeroes later, but I can not think of any way to preserve non-significant leading zeroes AND losing the dot.