Reply to Re: getting rid of trailing zeroes from a decimal output

Your name:

Reply:


Posted by Erland Sommarskog on 02/01/06 00:35

David Greenberg (davidgr@iba.org.il) writes:
> I use SqlServer 2000
> I am doing a select and sending the results, which is a cast() into
> decimal (9,3), in an email to various other users of our system.
> Problem is that a number like 95.2 is display as 95.200. Is there any
> way I can trim it so that it will display 95.2 ?

declare @val float
select @val = 9.2
select replace(
rtrim(
replace(
cast @val as decimal(9,3)),
'0', ' ')
),
' ', '0')


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация