22,210
社区成员
发帖
与我相关
我的任务
分享
CREATE TRIGGER triggerInsertClearAlarm
ON dbo.T_Stations
FOR INSERTAS
INSERT INTO T_ClearAlarm
(StID, Type)
select StID, Type from inserted
go
create trigger tri_name on table tb
for insert
as
begin
if @@rowcount>0
begin
insert into ta
select * from inserted
end
end
CREATE TABLE tb1 (id INT)
CREATE TABLE tb2 (id INT)
CREATE TRIGGER t1 ON tb1
FOR INSERT
AS
INSERT tb2 SELECT * FROM inserted
GO
INSERT tb1 SELECT 1
SELECT * FROM tb2
/*
id
-----------
1
*/
CREATE TRIGGER tgr_test ON tmp_A
FOR INSERT
AS
BEGIN
INSERT INTO tmp_B ([xxx]) SELECT [xxx] FROM INSERTED
END
GO
create trigger tri_name on table tb
for insert
as
begin
if @@rownumber>0
begin
insert into ta
select * from inserted
end
end