Dear i already create one table for employee information with ASP.net interface now i show add one operation in my table as below,
i have four columns( WorkDatey,WorkDatem,WorkDated,absentday) all the columns from integer type in table name employee.
now i should add new column (realworkdays) and the result here should be automatic save after entering previous data as example:
WorkDatey= 2011 ,
WorkDatem= 2 ,
WorkDated=14 ,
absentday=6
the operation should be : (2011*365)+(2*30)+(14)-(6) and result will store in column (realworkdays).
i already try it as trigger but i have some thing wrong:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER daysResult
ON [dbo].[employee]
AFTER insert
As
DECLARE @realworkdays int
BEGIN
SET NOCOUNT ON;
select WorkDatey,WorkDatem,WorkDated,absent from [dbo].[employee]
@realworkdays= (workdatey*350)+(workdatem*29)+(workdated)-(absent)
insert into [dbo].[employee] (totaldays)values (@realworkdays)
END
GO