Friday, March 30, 2012

How to Truncate

Hello again,
I also want to truncate some data which is a floating point number. But
it is calculated as a result of two other columns.
for example lets say
column1: 2,4
column2: 4,1483
the result is: 9,95592
but I want to truncate the first 2 digits after the decimal point.
like 9,95
also what is the rounding formula and how to use?
Thanks in advance.You're really talking about display formatting -which is better done in the
client application.
If you must have SQL Server change the format of this computed value, try:
SELECT cast( (Column1 * Column2 ) AS decimal(10.2) )
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Dot Net Daddy" <cagriandac@.gmail.com> wrote in message
news:1154637900.501096.298380@.m73g2000cwd.googlegroups.com...
> Hello again,
> I also want to truncate some data which is a floating point number. But
> it is calculated as a result of two other columns.
> for example lets say
> column1: 2,4
> column2: 4,1483
> the result is: 9,95592
> but I want to truncate the first 2 digits after the decimal point.
> like 9,95
> also what is the rounding formula and how to use?
>
> Thanks in advance.
>

No comments:

Post a Comment