--Function
create function dbo.funemp
(
@eid bigint,@name varchar(300),@sal float,@no_Of_day int,@month varchar(100))
returns float as
begin
declare @avgSal float
set @avgSal=(@sal/@month)*@no_of_day
return @avgSal
end
==============
Table
CREATE TABLE [dbo].[emp](
[Eid] [int] NOT NULL,
[Name] [varchar](30) NULL,
[Salary] [int] NULL,
[No_of_day] [int] NULL,
[MonthOfYear] [varchar](200) NULL,
)
==========
Query To Display Calculated Record Of Employee
--
select *,dbo.funemp(eid,name,salary,no_of_day,Monthofyear) as 'Total Salary' from emp