I'm developing HRIS that has many functions include attendance storage as shown in table:
| Attendance ID | Employee ID | Date | Present |
| INT (PK) | INT (FK) | DD/MM/YYYY | BIT (checkBox) |
now i'm thinking to set Attendance ID to be generating automatically by increasing one to avoid conflicting as long as it's primary key.
then I need to see attendance on another table of specific date clicked in celendar control.
any code available to reference on it?
thanks
Mangesh GPosted Jan 3, 2017, 6:27 AM
Create procedure ManipulateAttendence
(
@Date datetime =null,
@EmpID bigint=null,
@present Bit=null
)
as
if not exists(select 1 from attendance Where EmployeeID=@EmpID and Convert(varchar(100),Date,107)=Convert(varchar(100),GETDATE(),107))
begin
insert into attendance (EmployeeID,Present,Date) Values(@EmpID,1,GETDATE())
end
Else
Select * from attendance Where Convert(varchar(100),Date,107)=Convert(varchar(100),@Date,107) and EmployeeID=@EmpID
Try this In sql server making needed changes
Sulieman AlkatibPosted Jan 3, 2017, 6:03 AM
Mangesh GPosted Jan 3, 2017, 1:49 AM