View Single Post

   
  #3 (permalink)  
Old 02-29-2008, 07:51 PM
Erland Sommarskog
 
Posts: n/a
Default Re: 2005: forbidding INSERTs and DELETEs

R.A.M. (r_ahimsa_m@poczta.onet.pl) writes:
> I have a table with single row. I need to allow only UPDATEs of the
> table, forbid INSERTs and DELETEs. How to achieve it?


CREATE TRIGGER update_only FOR INSERT, DELETE AS
RAISERROR('INSERT and DELETE not permitted on this table!', 16, -1)
ROLLBACK TRANSACTION

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Reply With Quote