Re: Record level security?
- From: "zz12" <IDontLikeSpam@xxxxxxxxxxx>
- Date: Thu, 17 Jan 2008 16:14:08 -0800
Very cool.
Yes actually I have another table I'll refer to as [tblReadyToLock] that
holds 3 columns (FiscalYear, Quarter, Ready) which it can use to check on
with values like: 2008, 2, 'Yes'
Would you happen to know the syntax that would accommodate this for me?
Thanks a bunch Erland this appears to be exactly what I need.
"Erland Sommarskog" <esquel@xxxxxxxxxxxxx> wrote in message
news:Xns9A292347CAEAYazorman@xxxxxxxxxxxx
zz12 (IDontLikeSpam@xxxxxxxxxxx) writes:
Hello, is it possible to not allow changes to certain records in a sql2k
user table? We have a table that holds data for a periodic report and
was wondering if it would be possible to not allow any changes/deletions
to certain records that fall within a certain date period criteria as to
where this 'historic' data can't be altered.
CREATE TRIGGER ajabaja ON tbl FOR UPDATE, DELETE AS
IF EXISTS (SELECT *
FROM deleted
WHERE somedatecol BETWEEN '20070101' AND '20071231')
BEGIN
ROLLBACK TRANSACTION
RAISERROR ('Data is frozen and may not be deleted or altered', 16, 1)
RETURN
END
You probably need to find a way for the trigger to found how which is
the forbidden period. For instance you could read it from a table.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- Follow-Ups:
- Re: Record level security?
- From: Erland Sommarskog
- Re: Record level security?
- From: Tom Moreau
- Re: Record level security?
- References:
- Record level security?
- From: zz12
- Re: Record level security?
- From: Erland Sommarskog
- Record level security?
- Prev by Date: Re: Record level security?
- Next by Date: Re: Record level security?
- Previous by thread: Re: Record level security?
- Next by thread: Re: Record level security?
- Index(es):
Relevant Pages
|
|