CREATE TRIGGER InsteadTrigger on t_a after INSERT AS BEGIN INSERT INTO t_b(username) SELECT username FROM inserted END
CREATE TRIGGER 名1 ON dbo.tabMain FOR INSERT AS insert tabSlave select * from inserted go
CREATE TRIGGER InsteadTrigger on t_a after INSERT AS INSERT INTO t_b(username) SELECT username FROM inserted go
CREATE TRIGGER InsteadTrigger on t_a after INSERT AS INSERT INTO t_b(username) SELECT username FROM inserted go
--倒排序插入所有的记录:CREATE TRIGGER InsteadTrigger on t_a after INSERT AS INSERT INTO t_b(username) SELECT username FROM inserted order by userid dese go
--倒排序,只插入最后一条记录:CREATE TRIGGER InsteadTrigger on t_a after INSERT AS INSERT INTO t_b(username) SELECT top 1 username FROM inserted order by userid dese go
after INSERT
AS
BEGIN
INSERT INTO t_b(username)
SELECT username FROM inserted
END
CREATE TRIGGER 名1 ON dbo.tabMain
FOR INSERT
AS
insert tabSlave select * from inserted
go
after INSERT
AS
INSERT INTO t_b(username) SELECT username FROM inserted
go
after INSERT
AS
INSERT INTO t_b(username) SELECT username FROM inserted
go
after INSERT
AS
INSERT INTO t_b(username) SELECT username FROM inserted order by userid dese
go
after INSERT
AS
INSERT INTO t_b(username) SELECT top 1 username FROM inserted order by userid dese
go