不從特定 IP 不准某帳號登入 SQL Server

CREATE TRIGGER [connection_limit_trigger]
ON ALL SERVER
WITH EXECUTE AS ‘I7Administrator’
FOR LOGON
AS
BEGIN
IF ORIGINAL_LOGIN()= ‘a’ AND
not exists  (SELECT * FROM sys.dm_exec_connections
            WHERE client_net_address = ‘127.0.0.1’
            and session_id=@@SPID)
    ROLLBACK;
END;

–ENABLE TRIGGER [connection_limit_trigger] ON ALL SERVER

2 Comments

  1. Mercury
    Posted 2010 年 06 月 09 日 at 13:35:17 | Permalink | 回覆

    這需求又是我們部門提出來的吧…

  2. 百敬
    Posted 2010 年 06 月 09 日 at 14:08:17 | Permalink | 回覆

    不是,是一家銀行提出來的 ^^

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

%d 位部落客按了讚: