Question is not correctly framed i know, how do i code the below logic in T-SQL (SQL Server 2005) to increase a failure count for user registration system.
SELECT CASE WHEN (FailedPasswordWindowStart < GETDATE() >=
dateadd(minute,20,FailedPasswordWindowStart)) THEN 'Increase' ELSE 'Same' END FROM users
simply put, when the current time is within last attempt and time windows from last attempt then increase the failure count.
Here is a more easier way i could have done this. replace the variables as parameters to the stored procedure you might have created.
@Window– Time window within which the if a attempt is made should increase the count@LastAttempt– Last failure attempt(date and time)Edit
added
ABSsince the value obtained could be negative too 🙂