RSS 2.0 | Atom 1.0 | CDF

Search

Categories

Archive

Blogroll

Sign In

# Tuesday, May 01, 2007
Tuesday, May 01, 2007 12:53:15 PM (GMT Daylight Time, UTC+01:00) ( Database )
i found this was very hard to figure out.  i read lots of approaches to hack the data into char(5) etc to give you "23.54" using Round() etc.  but that seemed messy.  the key is to cast to type Numeric(size, decimalPlaces).  for example:
CONVERT(Numeric(10,2), (Count(ID) * 100. / @Total)) as Percentage

the above will display "23.54" (for example), including rounding, as a number.

Comments [3] | | # 
Saturday, July 11, 2009 2:15:02 PM (GMT Daylight Time, UTC+01:00)
does not work with MS Access sql ... function CONVERT is not defined.
Saturday, July 11, 2009 4:44:58 PM (GMT Daylight Time, UTC+01:00)
MS Access does not implement standard T-SQL, it has its own limited variation of SQL.
Good luck
Tim
tim
Wednesday, June 15, 2011 6:08:52 PM (GMT Daylight Time, UTC+01:00)
I need to be able to pass an integer which sets the number of decimal places. It doesn't seem to work to use a variable in the NUMERIC declaration...any ideas?
Eddie
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Live Comment Preview