Try this
SELECT CONVERT(DECIMAL(10,2),YOURCOLUMN)
such as
SELECT CONVERT(DECIMAL(10,2),2.999999)
will result in output 3.00

Try this
SELECT CONVERT(DECIMAL(10,2),YOURCOLUMN)
such as
SELECT CONVERT(DECIMAL(10,2),2.999999)
will result in output 3.00

Use Str() Function. It takes three arguments(the number, the number total characters to display, and the number of decimal places to display
Select Str(12345.6789, 12, 3)
displays: ' 12345.679' ( 3 spaces, 5 digits 12345, a decimal point, and three decimal digits (679). - it rounds if it has to truncate, (unless the integer part is too large for the total size, in which case asterisks are displayed instead.)
for a Total of 12 characters, with 3 to the right of decimal point.
sql server - Format value to configured number of decimal places - Database Administrators Stack Exchange
Formatting numbers (commas and decimal) – SQLServerCentral Forums
Newbie question. Sum of Float numbers in Bigquery results in many decimals
Round value to 2 decimal places
Videos
The STR function seems to be what you're looking for:
DECLARE @NumberOfDecimalPlaces tinyint = 3;
DECLARE @ActualValue decimal(16,5) = 3.50
SELECT FormattedActualValue =
STR(
@ActualValue,
CAST(@ActualValue / 10 AS int) + @NumberOfDecimalPlaces + 2,
COALESCE(@NumberOfDecimalPlaces,2)
)
You can't use parameters/variables for precision, so you'll need to use dynamic SQL for this. Performance overhead here is relatively close to zero.
DECLARE @NumberOfDecimalPlaces tinyint;
SET @NumberOfDecimalPlaces = 3;
DECLARE @sql nvarchar(max) = N'SELECT FormattedActualValue =
CONVERT(DECIMAL(16, $decimal_places$), 13.5457);';
SET @sql = REPLACE(@sql, N'$decimal_places$', COALESCE(@NumberOfDecimalPlaces,2));
EXEC sys.sp_executesql @sql;
After seeing Gianluca's answer I started to play with something else, which may or may not suit your needs (depending on whether you want trailing zeros when @DecimalPlaces > (decimal places in original value):
DECLARE @DecimalPlaces tinyint = 5,
@ActualValue decimal(16,5) = 3.561735;
SELECT LTRIM(STR(ROUND(@ActualValue,@DecimalPlaces),20,@DecimalPlaces));