如何使用触发器将记录插入到多个表中?

问题描述:

我有两张桌子.

我想同时在两个表上插入相同的记录.
即,当我为第一个表插入一条记录时,同样的记录也使用触发器插入到第二个表中.

I want to insert the same record on both tables at the same time.
I.e., while I insert a record for the first table, this same record also is inserted in the second table using a trigger.

您在这个过程中有什么经验/建议吗?

Do you have any experience/advice in this process ?

如果您正在使用存储过程,您可以轻松管理此

if you're using stored procedures you can easily manage this

CREATE PROCEDURE sp_Insert
@Value varchar(10)
AS
insert into table1 (...,...) values (@value,...)
insert into table2 (...,...) values (@value,...)