开发者

How to deny Delete for a single Row in a Table

开发者 https://www.devze.com 2023-03-16 08:00 出处:网络
I use SQL Server 2008. I need to DENY any delete operations on a specific ROW in a Table. I would like to know how can implement this feature at DB level.

I use SQL Server 2008.

I need to DENY any delete operations on a specific ROW in a Table.

I would like to know how can implement this feature at DB level.

Please provide a sample of T-SQL. 开发者_开发知识库Thanks for your time.


Create a trigger that throws an exception if the deleted row is your specific row.


Use INSTEAD OF DELETE trigger and ROLLBACK TRAN. Here is a good article on this.

0

精彩评论

暂无评论...
验证码 换一张
取 消