限定IP访问SQL Server
USE master
GO
alter TRIGGER tr_LoginCheck
ON ALL SERVER
FOR LOGON
AS
IF EVENTDATA().value('(/EVENT_INSTANCE/ClientHost)[1]', 'varchar(15)') <> '172.22.8.124'
ROLLBACK TRAN
GO
drop TRIGGER tr_LoginCheck ON ALL SERVER
GO
alter TRIGGER tr_LoginCheck
ON ALL SERVER
FOR LOGON
AS
IF EVENTDATA().value('(/EVENT_INSTANCE/ClientHost)[1]', 'varchar(15)') <> '172.22.8.124'
ROLLBACK TRAN
GO
drop TRIGGER tr_LoginCheck ON ALL SERVER