Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trigger Execution
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00799426
Message ID:
00799437
Views:
32
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
But now that I think about it, there is no way you can update more than one MAC address because it has a unique constraint on it.

>A trigger fires once per command regardless of how many rows are affected. Try
...
>	delete from ipdatabase.dbo.physicalAddress
> 	  Join deleted on physicalAddress.physical = deleted.physical
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform