34,594
社区成员
发帖
与我相关
我的任务
分享
CREATE TABLE [test] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[姓名] [varchar] (8) COLLATE Chinese_PRC_CI_AS NULL ,
[年龄] [int] NULL ,
CONSTRAINT [PK_test] PRIMARY KEY CLUSTERED
(
[id]
) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [tests] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[姓名] [varchar] (8) COLLATE Chinese_PRC_CI_AS NULL ,
[年龄] [int] NULL ,
CONSTRAINT [PK_tests] PRIMARY KEY CLUSTERED
(
[id]
) ON [PRIMARY]
) ON [PRIMARY]
GO
姓名 年龄
----------------------
张三 1
李四 2
王五 3
赵六 4
CREATE TRIGGER testtri ON dbo.test
FOR UPDATE
AS
update tests set
姓名=inserted.姓名,
年龄=inserted.年龄
from tests,deleted,inserted
where tests.姓名=deleted.姓名
CREATE TRIGGER testtri ON dbo.test
FOR UPDATE
AS
update tests set
姓名=inserted.姓名,
年龄=inserted.年龄
from tests,deleted,inserted
where tests.姓名=inserted.姓名