{love to code?}

September 18, 2007

Rounding decimal point value – SQL Server

Filed under: SQL — navaneethkn @ 9:17 AM

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

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.