You specify a DECIMAL datatype as DECIMAL(precision,scale), where 'precision' is the number of significant digits in the result, and 'scale' in the number of decimal places to the right of the decimal point. Thus:
CAST(40.0/3.0 AS DECIMAL(8,2))
Note the use of decimal constants in the expression; if this was written as 40/3 you'd get 13.00 as '40' and '3' are integers and the expression would be treated as an integer expression. Adding the decimal point forces them to be treated as decimal data type.
Jeff Mason
Custom Apps, Inc.
www.custom-apps.com