Hi All,
Can anyone help please? I have an issue where weekly timesheets are being used. By doing that it allows users to submit duplicate timesheets for the same week from the web application. Now we are facing a problem that users are submitting duplicate timesheets for the same days sometimes twice or 3 times a day and approvers get them approved.
Is there an easy way to to overcome this problem? Example: when a user tries to create a duplicate timesheet, a warning message pops warning them.
Regards,
Annmarie.
*This post is locked for comments
Hi Ann
If you have access to the application code then a check can be added before record is inserted in the application itself. or
the other solution which we did to overcome duplicate timesheet is to create a trigger on the database table. We haven't implemeted this solution yet to be tested on UAT.
/****** Object: Trigger [dbo].[trg_DuplicateTS] Script Date: 07/18/2013 15:23:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create TRIGGER [dbo].[trg_StopDuplicateTS] ON [dbo].[PDK10000] FOR insert
AS
DECLARE @A INT
SET @A=(
SELECT TOP 1 substring(T1.PDK_TS_NO,LEN(T1.PDK_TS_NO),1)
FROM inserted AS T1
JOIN [PDK10000] AS T2
ON substring(T1.PDK_TS_NO,1,LEN(T1.PDK_TS_NO)-1)=substring(T2.PDK_TS_NO,1,LEN(T2.PDK_TS_NO)-1)
ORDER BY substring(T1.PDK_TS_NO,LEN(T1.PDK_TS_NO),1) DESC)
print @A
IF(@A>1)
BEGIN
ROLLBACK TRAN
RAISERROR('Timesheet Already Exists Duplicates Are Not Allowed',16,1)
END
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156