Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Mar 6 at 5:13

This question came from our site for professional and enthusiast programmers.

4  
Use permissions to "restrict any user from creating a new table in the database " –  Mitch Wheat Feb 19 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 at 7:21

1 Answer 1

up vote 0 down vote accepted

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
share|improve this answer
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 at 12:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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