|
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
Navigation:
[Reply to this message]
|