Skip to content

Instantly share code, notes, and snippets.

@lionofdezert
lionofdezert / LogonTrigger.sql
Created July 24, 2012 07:21
SQL Server: Restrict Login from Valid Machine IPs Only (Using Logon Trigger)
USE master
GO
-- Create table to hold valid IP values
CREATE TABLE ValidIPAddress (IP NVARCHAR(15)
CONSTRAINT PK_ValidAddress PRIMARY KEY)
-- Declare local machine as valid one
INSERT INTO ValidIPAddress
SELECT '<local machine>'