Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
a4u6178
Starting Member
11 Posts |
Posted - 2012-03-12 : 06:09:51
|
Hi all, I am trying to calculate percentage value using scalar function it returns NULL resultHere is the function:alter Function calculateComission(@discount nvarchar(25),@regFEE varchar(25),@comissionPercentage nvarchar(25))RETURNS varchar(25)AS BEGINDECLARE @dicountedREGFEE DECIMAL,@comission DECIMAL;set @dicountedREGFEE=((cast(@discount as DECIMAL(18,2)) *cast(@regFEE as DECIMAL(18,2)))/100);set @comission=((@dicountedREGFEE * cast(@comission as DECIMAL(18,4)))/100); return @comissionEND calling function:DECLARE @result DECIMALset @result=select dbo.calculateComission('20','29.01','4.5') as resultprint @resultThanks & Regards, |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
|
|