Sometimes cases are generated in that users drop the table from database without informing or by mistake dropped any table then If you want to prevent to drop the table by some user, you can use the following SQL statement ,
DENY DELETE ON OBJECT::SchemaName.TableName TO RistrictedUser;
The other Deny permission for a user then the following SQL statement is used. First deny the SELECT statement for a particular user.
DENY SELECT ON OBJECT::SchemaName.TableName TO RistrictedUser;
You also used the following SQL statement for deny the UPDATE table statement for a particular user.
DENY UPDATE ON OBJECT::SchemaName.TableName TO RistrictedUser;
The above SQL statement is used to Deny the drop permission on a particular user.
If you want to restrict on all the user at a time to deny drop permission of all table in your database then you have need to create a DDL Trigger in your database which stop the drop permission of tables. The following SQL statement is used to create a trigger on database to deny the permission,
CREATE TRIGGER TR_DropTable
ON DATABASE
FOR DROP_TABLE
AS
BEGIN
BEGIN TRAN
PRINT 'Drop Table are not allowed!!!'
ROLLBACK TRAN;
END
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Deny Drop Permission for a Table:
Sometimes cases are generated in that users drop the table from database without informing or by mistake dropped any table then If you want to prevent to drop the table by some user, you can use the following SQL statement ,
The other Deny permission for a user then the following SQL statement is used. First deny the SELECT statement for a particular user.
You also used the following SQL statement for deny the UPDATE table statement for a particular user.
The above SQL statement is used to Deny the drop permission on a particular user.
If you want to restrict on all the user at a time to deny drop permission of all table in your database then you have need to create a DDL Trigger in your database which stop the drop permission of tables. The following SQL statement is used to create a trigger on database to deny the permission,