Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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

thank you

share|improve this question
    
Why are you trying to use EXECUTE AS at all here? –  Aaron Bertrand Mar 1 at 16:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.