触发器 SQL 插入和更新

Trigger SQL insert and update

我有两个 table INVENTORYINPUT

create table INPUT(
PRODUCTID nvarchar(10),
QUANTUMINPUT int
)

create table INVENTORY(
PRODUCTID nvarchar(10),
QUANTUM int,
QUANTUMINPUT int,
LASTQUANTUM int
)

如何在插入列QUANTUMINPUT、table INVENTORY 转换时在SQL 上创建SQL trigger

Create trigger tr_update_insert_input
On dbo.[input]
After insert, update 
As 
Begin 
 Set nocount on; 

 Update intry
  Set intry.quantumnput = inpt.quantuminput
 From inventory intry inner join inserted inpt
 On intry.productid = inpt.productid 

End