Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trigger Execution
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00799426
Message ID:
00799440
Vues:
20
You would use primary key (pk in the sample code). Something Like
update ipdatabase.dbo.physicalAddress 
	set physical =  inserted.physical 
	Join deleted on physicalAddress.pk  = deleted.pk 
	Join inserted on physicalAddress.pk = inserted.pk 
>Thats interesting, I've never done a join on a delete statement.
>
>One more question.. How would I handle multiple updates. Right now I have:
>
>
>ALTER   TRIGGER updateMAC ON [dbo].[astudent] FOR  UPDATE AS
>
>/*If the nic column was updated */
>
>if update(nic)
>begin
>	declare @newMAC varchar(16), @oldMAC varchar(16)
>
>	/* Get the new and old mac address */
>	select @newMAC = nic from inserted
>	select @oldMAC = nic from deleted
>
>	/* Update the ipdatabase table */
>	update ipdatabase.dbo.physicalAddress
>	set physical =  @newMAC
>	where physical = @oldMAC
>
>
>end
>
>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform