SQL Server Security through TSQL

I want to build a transact sql script that will stop certain people from executing certain commands against all databases:

drop database, drop table or preferbly drop *

delete

update

Is it possible? The user will already have access to the server.

Note. I am not trying to develop a security model for the server or prevent a malicious attack. This is an existing server where people can have a number of access rights through the various Windows groups to which they belong. I just want to know if there is quick protection so that people do not mistakenly execute the command on the wrong server.

+5
source share
6 answers

SQL Server 2005 2008, , , DDL. DDL , sysadmin - DDL. , , , .

SQL Server 2000 ( ), - /. , , SQL Server 2005 2008, .

+1

( caveat, , , )

, ( dbo)? , , , . GRANT , , REVOKE , , DENY , , - .

. MSDN.

+6

, drop, - -

, exec exec

print ( convert(varchar(50), 0x64726F7020646174616261736520616263))

exec .

DDL http://msdn.microsoft.com/en-us/library/ms190989.aspx

CREATE TRIGGER safety 
ON DATABASE 
FOR DROP_TABLE, ALTER_TABLE 
AS 
   PRINT 'You are not allowed to drop or alter tables!' 
   ROLLBACK
;
0

Cindi - DENY permissions, .

. SQL ? , , SQL ?

, , DENY. , . , .

. , , , . DENY, GRANT Select ( , , ).

0

SQL Server, , . , SQL Server, Oracle ( ).

, , . , .

, , , :

  • (, , )

.

0
source

All Articles