Reputation: 13
I want to create a trigger to get values from one to table and transfer them to another table and update.
Something like this:
UPDATE [dbo].[TABLE1]
SET CapelaWin = 2,
ProcyonWin = 1
WHERE [dbo].[table2].[VictoryNation] = 1;
I have already searched around thru stackoverflow and google but didn't find my answer.
Upvotes: 1
Views: 184
Reputation: 2024
If you know how the tables are connected(they should have relations with each Other) you can use this template to do your work
UPDATE [dbo].[TABLE1]
SET CapelaWin = 2,
ProcyonWin = 1
from [dbo].[TABLE1] inner join [dbo].[TABLE2] on [dbo].[TABLE1].fld1 =[dbo].[TABLE1].fld2
WHERE [dbo].[table2].[VictoryNation] = 1;
and you should define when your trigger will fire.
Upvotes: 1