Question : Deny permissions to create table/index

How to deny a user from being able to create any tables, index, but is ok to create procs or views.

the user will also have ddladmin privilege.

thanks

Answer : Deny permissions to create table/index

>> How can we make the above code to apply one for a particular user?

This should do:

USE MyDatabase
IF EXISTS (SELECT * FROM sys.triggers
   WHERE parent_class = 0 AND name = 'safety')
DROP TRIGGER safety
ON DATABASE
GO
CREATE TRIGGER safety
ON DATABASE
FOR CREATE_TABLE
AS
IF ( SELECT suser_name()) = ur_user_name
BEGIN
  PRINT 'You cannot add the object!'
  ROLLBACK
END
GO
DROP TRIGGER safety
ON DATABASE
GO
Random Solutions  
 
programming4us programming4us