How do i restrict all users from deleting a table data.. [Resolved]

Posted by Skraghava under Sql Server on 6/20/2010 | Views : 3027 | Status : [Member] | Replies : 3
Hi all,

How do i restrict all users from deleting a table data..

(they should be restricted from excecuting the delete from table ) statement..

Please answer me..

Thanks
Raghavendra

Thanks and regards,
Raghavendra SK



Responses

Posted by: Syedshakeer on: 6/20/2010 [Member] Starter

Up
0
Down

Resolved
Hi,
Check the following link,it will helps you
http://beginner-sql-tutorial.com/sql-grant-revoke-privileges-roles.htm

Syed Shakeer Hussain

Skraghava, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Syedshakeer on: 6/20/2010 [Member] Starter

Up
0
Down
Hi SKraghava,
you can Restrict the deleting Table using DDl Triggers as follows:

1) if you want to Restrict only on particular tables use the below ddl trigger
CREATE TRIGGER trig_name


ON table_name

FOR DELETE

AS
BEGIN
PRINT " you cannot delete the TABLE"
End


2)If you want to Restrict all table in a DataBase use the below ddl trigger

CREATE TRIGGER trig_name

ON DATABASE_Name
FOR DROP_SYNONYM
AS
Begin
Print 'You Cannot Drop trigge tables'
ROLLBACK
End
GO




Syed Shakeer Hussain

Skraghava, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Skraghava on: 6/20/2010 [Member] Starter

Up
0
Down
Hi Syed,

Thanks for the reply.

If i create trigger this will be applicable to all. However i have to restrict deleting to users and admin/super user should be able to delete it.

So is there any way that we can set some properites on table such that only user belonging to particualar group can be deleted.



Thanks and regards,
Raghavendra SK

Skraghava, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response