Click here to Skip to main content
15,851,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi to all
i want to restrict SSMS connection to my sql server
i used this query and create a table and define my vaild ip address for connecting
and query execute successfully but when i connect to my server error has been occured for this trigger

SQL
create trigger tr_logon_checkip
on all server
for logon as
begin
if is_srvrolemember('sysadmin') = 1
begin
Declare @IPAddress NVARCHAR(15)
SET @IPAddress = (SELECT EVENTDATA().value ('(/EVENT_INSTANCE/ClientHost)[1]','NVARCHAR(15)'));
if not exists
(select ip from test.dbo.ValiAddress where ip = @IPAddress)
rollback;
end;
end;

please help me.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900