SQLSoldier Jul 16th, 2013 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- CREATE TRIGGER ltAdminsOnly
- ON ALL SERVER WITH EXECUTE AS N'sa'
- FOR LOGON
- Declare @IsAdmin int;
- Exec As login = ORIGINAL_LOGIN();
- Select @IsAdmin = ISNULL(IS_MEMBER('Domain\AdminGroup'), 0);
- If HOST_NAME() <> @@SERVERNAME
- And HOST_NAME() <> SERVERPROPERTY('ComputerNamePhysicalNetBios')
- And @IsAdmin = 0
RAW Paste Data