I am attempting to create a "read" trigger. My client has an older system that uses select statements to validate userid and passwords. Now they want to be able to implement an automated lockout after X failed attempts in Y minutes.
My current approach is ot use view based on a table value function to replace the original users table.
The TVF works fine and the account lockout (using a secondary non-enlisted connection) also works fine.
Unfortunately as soon as I starting working on the instead of triggers for update and delete I receive errors.
If I can solve one error the same solution will most likely solve the others as well...
The first error is:
A .NET Framework error occurred during execution of user-defined routine or aggregate "TestUserTable":
"Invalid use of side-effecting or time-dependent operator in 'UPDATE' within a function."
I recieve this when I attempt to execute the following sql:
update usertable set manager='fubar' where loginid='Chris'
at this point in time the update instead of trigger is defined as follows:
create trigger tr_vwUserTable on UserTable
Instead of update
--do nothing for now
update usertable_old set manager='fubar'
My understanding is that instead of triggers execute...well instead of the action...so why am I receiving this obscure error?