Re: prevent updates/deletes on certain rows
From: Narayana Vyas Kondreddi (answer_me_at_hotmail.com)
Date: 08/18/03
- Next message: Gerry: "Changing Security Audit Option"
- Previous message: Rafael Wittek: "prevent updates/deletes on certain rows"
- In reply to: Rafael Wittek: "prevent updates/deletes on certain rows"
- Next in thread: Rafael Wittek: "Re: prevent updates/deletes on certain rows"
- Reply: Rafael Wittek: "Re: prevent updates/deletes on certain rows"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 18 Aug 2003 17:14:06 +0100
Here's an example:
CREATE TRIGGER xy
ON test
FOR DELETE, UPDATE
AS
BEGIN
IF EXISTS
(
SELECT 1
FROM deleted
WHERE lock = 1
)
BEGIN
ROLLBACK
RAISERROR('cannot update rows with lock = 1', 16, 1)
END
END
-- HTH, Vyas, MVP (SQL Server) http://vyaskn.tripod.com/ What hardware is your SQL Server running on? http://vyaskn.tripod.com/poll.htm "Rafael Wittek" <Rafael.Wittek@avag.de> wrote in message news:OJD$U%23ZZDHA.628@TK2MSFTNGP10.phx.gbl... hi, I want to implement a row-locking or row-write-protect mechnism, that prevents certain rows of a table (e.g. that ones with lock (bit)=1) to be modified or deleted. I think the best way is to this by triggers, but how ? this one doesn´t work create trigger xy on table test for update, delete if lock=1 then rollback Rafa
- Next message: Gerry: "Changing Security Audit Option"
- Previous message: Rafael Wittek: "prevent updates/deletes on certain rows"
- In reply to: Rafael Wittek: "prevent updates/deletes on certain rows"
- Next in thread: Rafael Wittek: "Re: prevent updates/deletes on certain rows"
- Reply: Rafael Wittek: "Re: prevent updates/deletes on certain rows"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|