复制代码 代码如下:
CREATE TRIGGER 触发器名称
ON A表
AFTER INSERT
AS BEGIN INSERT INTO
B表(B表字段1,B表字段2,B表字段3)
SELECT A表字段1,A表字段2,A表字段3
FROM INSERTED
END
复制代码 代码如下:
CREATE TRIGGER 触发器名称
ON A表
AFTER DELETE
AS BEGIN DELETE B表
WHERE
B表主键 IN(
SELECT A表主键
FROM DELETED)
END
复制代码 代码如下:
CREATE TRIGGER 触发器名称
ON A表
AFTER UPDATE
AS
update B表
SET
B.B表字段1=A.A表字段1
FROM
B表 AS B,INSERTED AS A
WHERE B.B表主键=A.A表主键
新闻热点
疑难解答