Groups | Blog | Home
all groups > sql server (alternate) > march 2004 >

sql server (alternate) : Truncating a number


clequieu NO[at]SPAM nuvell.com
3/26/2004 11:28:40 AM
I am currently working on a SQL table in which I am calculating a
percentage of several fields and then converting that number to a
percentage. The formula is working, but it is giving me a number with
6 decimal places. What is the best way to truncate this number to 2
digits?

Steve Jorgensen
3/26/2004 7:33:56 PM
Cast the result to something like DECIMAL(10,2). Replace the 10 with
whatever's appropriate in your case.

[quoted text, click to view]
John Bell
3/26/2004 7:44:43 PM
Hi

You probably want to convert to decimal (see CAST in Books online) and
specify the precision and scale.

If that does not work them post your code.

John


[quoted text, click to view]

AddThis Social Bookmark Button