We have following scenario:
create table User {Id bigint, UserName nvarchar(50), GroupId bigint};
create table Group {Id bigint, GroupName nvarchar(50)};
create view UserView as
SELECT u.Id, u.UserName, g.GroupName
from User u
inner join Group g on u.GroupId = g.Id
Now I'd like to create one trigger on the view which is fired if the User table is updated or/and if the group table is updated.
Is this possible somehow using T-SQL?
Using INSTEAD OF triggers doesn't work because they are fired only if you perform updates directly to the view.
Thanks.
No, this is not possible. You'll have to define your triggers on the tables that are involved in the view in order to process changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With