Wednesday, 18 February 2015

Sql Server Find Percentage Calculation Function

CREATE FUNCTION [dbo].[Percentage]
(
    @Percentage               DECIMAL(4,2)      ,
    @ColumnNameValue    DECIMAL(7,2)     
)
RETURNS DECIMAL(7,2)
BEGIN
    DECLARE
            @Output DECIMAL(7,2)
            SET @Output = (@Percentage/100)*@ColumnNameValue
    RETURN @Output
END


select Percentage(10,1000)

output : 100

Kindly Bookmark and Share it:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...