Rounding decimal point value – SQL Server

To round value into fixed decimal points, we need to make use of convert function. Convert the value in to decimal type by specifying decimal points. Following function rounds value into two decimal points

CREATE FUNCTION RoundMoney (@Value money)
RETURNS Varchar(50) AS
BEGIN
Declare @ReturnValue varchar(50)
Set @ReturnValue = ( Select CONVERT(decimal(12,2),@Value ) )
Return (@ReturnValue)
END

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s