Click here to Skip to main content
15,036,145 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This is the user defined function which I have created but unable to execute it. Please help me. Thanks in advance.

Table - user_def_fun

SQL
create function userdefFunction
(
@Id int,
@NormalHours float,
@OvertimeHours float
)
Returns money
AS
Begin
Declare @Hourlyrate money
Declare @Overtimerate money
select @Hourlyrate=Hourlyrate,
@Overtimerate =Overtimerate
from
user_def_fun
where Id= @Id
RETURN (@Hourlyrate * @NormalHours) + (@Overtimerate * @Overtimehours)
END
Posted
Updated 12-Dec-12 0:11am
v2

include schema-name

in your case, it should be called as below...
SQL
select dbo.userdefFunction(1,9,9)

Happy Coding!
:)
   
Comments
__TR__ 12-Dec-12 8:39am
   
My 5!
Aarti Meswania 12-Dec-12 23:34pm
   
thank you! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900