1

How do I create a SQL Server trigger that will restrict any users from creating a new table in the database?

Please help me with this.

Thanks & Regards, Ritesh.

2
  • 4
    Use permissions to "restrict any user from creating a new table in the database " – Mitch Wheat Feb 19 '14 at 5:56
  • 3
    Or more exactly, don't grant them the permissions needed to create tables in the first place. – Damien_The_Unbeliever Feb 19 '14 at 7:21
0

If you really must use a trigger you can use a database trigger.

CREATE TRIGGER NoCreateTable ON DATABASE 
    FOR CREATE_TABLE
AS 
PRINT 'You may not create a table' 
ROLLBACK TRANSACTION
1
  • 3
    Keep in mind that you will still have created the table. Its just that it gets rolled back. A small difference,but it may be important to you. – Ben Thul Feb 19 '14 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.