I want to create a simple login trigger. basically if user = test , then send an email to me.
CREATE TRIGGER ServerLogon ON ALL SERVER WITH EXECUTE AS 'test' FOR LOGON AS BEGIN IF ORIGINAL_LOGIN()= 'test' -- send email to me ROLLBACK END
But I cannot execute as 'test'
it says the user does not exists or you do not have pemission but even when I use my username or make test as a sysadmin / db owner it still says the same thing