Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Deleted and inserted tables

Author  Topic 

rammohan
Posting Yak Master

212 Posts

Posted - 2008-10-17 : 10:21:47
hello everyone, I have a problem with deleted and inserted system tables. I tried use them with triggers but the thing i have is just an error message like

Msg 4104, Level 16, State 1, Procedure arsa_delete, Line 4
The multi-part identifier "deleted.ID" could not be bound.


my trigger is something like:
CREATE TRIGGER arsa_delete ON arsa
FOR DELETE
AS
DELETE FROM ilanlar WHERE TID = deleted.ID


Could you please help me?
I am really stuck.
PS: I am using sql server express edition.

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-17 : 10:25:45
[code]CREATE TRIGGER arsa_delete ON arsa
FOR DELETE
AS
DELETE FROM ilanlar i
INNER JOIN DELETED d
ON i.TID = d.ID
GO[/code]
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-10-17 : 10:27:30
virtual tables are available for use in triggers but you still have to include them in your FROM clause in order to reference them. (as visakh16 demonstrates)


Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -