Re: Record level security?
- From: "zz12" <IDontLikeSpam@xxxxxxxxxxx>
- Date: Fri, 18 Jan 2008 15:52:57 -0800
Is "deleted d" referring to the table that the trigger is being created
on?...or is it necessary syntax as is? I'm trying to slightly adjust the
code to work with our real table names and fields and I have the RAISERROR
error working on the insert and update action but seems like the trigger is
not sensing the delete action and it is allowing it to delete a test record
which is suppose to be frozen.
This trigger lock method is going to save the day in freezing our mission
critical data. Thanks so much Erland.
"Erland Sommarskog" <esquel@xxxxxxxxxxxxx> wrote in message
news:Xns9A2AF8EF3E5Yazorman@xxxxxxxxxxxx
zz12 (IDontLikeSpam@xxxxxxxxxxx) writes:
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?
IF EXISTS (SELECT *
FROM deleted d
JOIN tblReadyToLock L ON year(d.somedate) = L.FiscalYear
AND datepart(q, d.somedate) = L.Quarter
WHERE L.Ready = 'Yes')
I did not recall the code for quarter in Datepart, so I had to guess.
Look it up in Books Online if it does not work.
--
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?
- References:
- Record level security?
- From: zz12
- Re: Record level security?
- From: Erland Sommarskog
- Re: 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
|
|