USE master
GO
CREATE TRIGGER tr_LoginCheck
ON ALL SERVER
FOR LOGON
AS
declare @strLoginIp nvarchar(15);
set @strLoginIp=EVENTDATA().value('(/EVENT_INSTANCE/ClientHost)[1]', 'nvarchar(15)');
IF (@strLoginIp<> '1.1.1.2' and @strLoginIp!='127.0.0.1' and @strLoginIp!='1.1.2.3')
ROLLBACK TRAN
GO