Home > Archive > MS SQL Server > March 2005 > Trailing Zeros









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Trailing Zeros
Forch

2005-03-30, 7:03 pm

Hi guys....

I have a field in one of my tables of type Numeric(10, 5).

I would like to convert the data into a varchar, but I want to be rid of all
trailing zeros. So, 123.12000 would look like 123.12, and 123.00000 would
look like 123

Any ideas?

Thanks,

Forch
jrpm

2005-03-30, 7:03 pm

try a double conversion
ie select convert(char,(conver
t(money,field))) from.......

"Forch" wrote:

> Hi guys....
>
> I have a field in one of my tables of type Numeric(10, 5).
>
> I would like to convert the data into a varchar, but I want to be rid of all
> trailing zeros. So, 123.12000 would look like 123.12, and 123.00000 would
> look like 123
>
> Any ideas?
>
> Thanks,
>
> Forch

Hari Prasad

2005-03-30, 7:03 pm

This will come closer.

declare @t numeric(10,5)
set @t = 123.00000
select convert(varchar,cast
(@t as money),1)

Thanks
Hari
____________________
________________
Forch Wrote:

Hi guys....

I have a field in one of my tables of type Numeric(10, 5).

I would like to convert the data into a varchar, but I want to be rid of all
trailing zeros. So, 123.12000 would look like 123.12, and 123.00000 would
look like 123

Any ideas?

Thanks,

Forch







Sent via SreeSharp NewsReader http://www.SreeSharp.com
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com