Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. Create TRIGGER tr_CheckIP ON ALL SERVER
  2. FOR LOGON
  3. AS
  4. BEGIN
  5. DECLARE @IPAddress NVARCHAR(50) ;
  6. If ORIGINAL_LOGIN()='test'
  7.  
  8. --print ORIGINAL_LOGIN()
  9. begin
  10.  
  11.  
  12. SET @IPAddress = convert(NVARCHAR(50),ConnectionProperty('client_net_address'))
  13. --print @IPAddress
  14. IF NOT EXISTS ( SELECT IP
  15. FROM master..IPAddress
  16. WHERE IP = @IPAddress )
  17. BEGIN
  18.  
  19.  
  20. ROLLBACK
  21. END
  22. End
  23. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement