|
Home > Archive > MS SQL Server > July 2005 > Problem in Instead Trigger
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Problem in Instead Trigger
|
|
| sathya 2005-07-23, 7:23 am |
| hi,
i am using trigger as below:
alter TRIGGER Docsdelete
ON Docs
INSTEAD OF DELETE
AS
Declare @DeletedDocLibRowId int
declare @Dirname nvarchar(256)
declare @LeafName nvarchar(128)
set @Dirname = (SELECT dirname FROM DELETED)
set @LeafName = (SELECT leafname FROM DELETED)
set @DeletedDocLibRowId = (SELECT doclibrowid FROM DELETED)
if(@DeletedDocLibRow
Id IS NULL)
BEGIN
DELETE docs from deleted where docs.dirname = @Dirname and
docs.leafname = @LeafName
END
my problem is that i want to delete row in instead of trigger method,
but when i use this method, i cannot delete my row , the row seems to
be still in table even when i apply my trigger.
please anyone help me in this regard.
sathya naryanan v
naraya...@gsdindia.com
| |
| Jens Süßmeyer 2005-07-23, 7:23 am |
| Please do not multi or crosspost, answered in .programming.
HTH, Jens Suessmeyer.
"sathya" < sathyanarayananit@gm
ail.com> wrote in message
news:1122115220.602477.57340@g43g2000cwa.googlegroups.com...
> hi,
>
>
> i am using trigger as below:
>
>
> alter TRIGGER Docsdelete
> ON Docs
> INSTEAD OF DELETE
> AS
> Declare @DeletedDocLibRowId int
> declare @Dirname nvarchar(256)
> declare @LeafName nvarchar(128)
> set @Dirname = (SELECT dirname FROM DELETED)
> set @LeafName = (SELECT leafname FROM DELETED)
> set @DeletedDocLibRowId = (SELECT doclibrowid FROM DELETED)
> if(@DeletedDocLibRow
Id IS NULL)
> BEGIN
> DELETE docs from deleted where docs.dirname = @Dirname and
> docs.leafname = @LeafName
> END
>
>
> my problem is that i want to delete row in instead of trigger method,
> but when i use this method, i cannot delete my row , the row seems to
> be still in table even when i apply my trigger.
>
>
> please anyone help me in this regard.
>
>
> sathya naryanan v
> naraya...@gsdindia.com
>
| |
|
| Maybe you mean
DELETE docs FROM deleted WHERE docs.dirname = deleted.dirname AND
docs.leafname = deleted.leafname
the DELETED table contains all the rows that will be deleted, not each
individual one
--
Best regards
Mark Baldwin
"sathya" < sathyanarayananit@gm
ail.com> wrote in message
news:1122115220.602477.57340@g43g2000cwa.googlegroups.com...
> hi,
>
>
> i am using trigger as below:
>
>
> alter TRIGGER Docsdelete
> ON Docs
> INSTEAD OF DELETE
> AS
> Declare @DeletedDocLibRowId int
> declare @Dirname nvarchar(256)
> declare @LeafName nvarchar(128)
> set @Dirname = (SELECT dirname FROM DELETED)
> set @LeafName = (SELECT leafname FROM DELETED)
> set @DeletedDocLibRowId = (SELECT doclibrowid FROM DELETED)
> if(@DeletedDocLibRow
Id IS NULL)
> BEGIN
> DELETE docs from deleted where docs.dirname = @Dirname and
> docs.leafname = @LeafName
> END
>
>
> my problem is that i want to delete row in instead of trigger method,
> but when i use this method, i cannot delete my row , the row seems to
> be still in table even when i apply my trigger.
>
>
> please anyone help me in this regard.
>
>
> sathya naryanan v
> naraya...@gsdindia.com
>
|
|
|
|
|