我正在尝试在将项目插入表后创建一个触发器函数,但我收到语法错误并且不确定发生了什么。有人可以帮忙吗?这是我的语法:
GO
CREATE TRIGGER trgAfterInsert ON [DR].[dbo].[Derived_Values]
FOR INSERT
AS
declare @BusinessUnit varchar(75);
declare @Questions varchar(max);
declare @Answer nchar(10);
select @BusinessUnit=i.@BusinessUnit from inserted i;
select @Questions=i.@Questions from inserted i;
select @Answer=i.@Answer from inserted i;
insert into [Main].[dbo].[Derived_Values_Test]
(BusinessUnit,Questions, Answer)
values(@BusinessUnit,@Questions, @Answer);
PRINT 'AFTER INSERT trigger fired.'
GO