From: Alfred on
Via a calculation, how do you truncate to 2 decimal places ?

..678952 should be .67

I have seen where people have suggested Round(.678952 , 2 , 1)

But I got an error message when i tried that....


From: Plamen Ratchev on
What error do you get? I just tied:

SELECT ROUND(.678952, 2, 1);


Results in:

---------
0.670000

--
Plamen Ratchev
http://www.SQLStudio.com
From: Alfred on
Funny... when i put the expression in a view I get "Function argument count
error" - but when i write it out in the select it works - hmmm

Thanks !


"Plamen Ratchev" <Plamen(a)SQLStudio.com> wrote in message
news:VqednWZ54t05PQLWnZ2dnUVZ_vc4AAAA(a)speakeasy.net...
> What error do you get? I just tied:
>
> SELECT ROUND(.678952, 2, 1);
>
>
> Results in:
>
> ---------
> 0.670000
>
> --
> Plamen Ratchev
> http://www.SQLStudio.com


From: Plamen Ratchev on
Seems to work fine in a view:

CREATE VIEW Foo (x)
AS
SELECT ROUND(.678952, 2, 1);

GO

SELECT x FROM Foo;

x
---------
0.670000

--
Plamen Ratchev
http://www.SQLStudio.com
From: Alfred on

Yes, as long as you type it in the sql statement... try using the "view"
designer tool in Management studio...

"Plamen Ratchev" <Plamen(a)SQLStudio.com> wrote in message
news:VqednWF54t1NOwLWnZ2dnUVZ_velnZ2d(a)speakeasy.net...
> Seems to work fine in a view:
>
> CREATE VIEW Foo (x)
> AS
> SELECT ROUND(.678952, 2, 1);
>
> GO
>
> SELECT x FROM Foo;
>
> x
> ---------
> 0.670000
>
> --
> Plamen Ratchev
> http://www.SQLStudio.com