我正在创建一个SSIS包。 在这个包中,我有一个数据流,我在其中插入一个CSV(源)的数据库(目的地)。
包装完美无缺。
当我尝试同时触发触发器时,会出现问题。为此,我正在编辑目标组件的属性。特别是在属性我正在添加,FIRE_TRIGGERS
以下:
FastLoadOptions | TABLOCK,CHECK_CONSTRAINTS,FIRE_TRIGGERS
现在,当我运行包时,我收到以下错误:
[OLE DB Destination [139]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.".
我遵循了这篇文章Unable to access sql server configuration manager,我只是从Admin-CMD执行了以下命令(我有SQL Server 2016)
cd "C:\Program Files (x86)\Microsoft SQL Server\140\Shared"
Then Run :
mofcomp sqlmgmproviderxpsp2up.mof
但仍然没有。
感谢您的帮助!
我的系统:Windows10,SQL Server 2016,Visual Studio 2015
编辑:触发器代码如下:
DROP TRIGGER IF EXISTS AccidentsTrigger
GO
USE SSIS_db;
GO
CREATE TRIGGER AccidentsTrigger
ON [Accidents]
AFTER INSERT AS
BEGIN;
SET NOCOUNT ON;
IF (SELECT [second_road_class] FROM INSERTED) LIKE '-1'
BEGIN;
UPDATE a
SET [second_road_class] = '6'
FROM [Accidents] AS a
INNER JOIN INSERTED i ON a.accident_index = i.accident_index AND i.[second_road_class] = '-1';
END;
END;
GO
答案 0 :(得分:0)
显然有两个错误。触发器导致多行,并且SQL Server代理在默认情况下处于手动启动状态(它需要处于自动状态)。可以通过SQL Server配置管理器访问SQL Server代理服务。