Re: Create Delete Trigger on Table1 to Update a filed on Table2
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Sat, 12 Jan 2008 14:53:59 +0000 (UTC)
SagiPhoenix@AlbionLab (zkvneml@xxxxxxxxx) writes:
ad the condition of the deleted deleted record's identity ID to the
update statement. the ID can be fetched using
select @recKeyID = {identity column name} from deleted
No! No! No!
A trigger fires once per *statement* and there can be more than one
row in deleted/inserted.
And who says that the table has an IDENTITY column? If you have IDENTITY
columns in all your tables, you have a habit that you need to change.
--
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
.
- References:
- Create Delete Trigger on Table1 to Update a filed on Table2
- From: Yas
- Re: Create Delete Trigger on Table1 to Update a filed on Table2
- From: SagiPhoenix@AlbionLab
- Create Delete Trigger on Table1 to Update a filed on Table2
- Prev by Date: Re: Create Delete Trigger on Table1 to Update a filed on Table2
- Next by Date: Re: check the word whether correct or not
- Previous by thread: Re: Create Delete Trigger on Table1 to Update a filed on Table2
- Next by thread: Re: DTS-Package sends mail and files before the job finishes
- Index(es):
Relevant Pages
|
Loading