SSIS 错误:无法从 SQL 命令的参数中检索目标列描述
Posted
技术标签:
【中文标题】SSIS 错误:无法从 SQL 命令的参数中检索目标列描述【英文标题】:SSIS Error: Unable to retrieve destination column descriptions from the parameters of the SQL command 【发布时间】:2019-02-21 22:52:14 【问题描述】:我收到一个错误:
[将更新的记录加载到 Table_vwAs_FixedIdentifier [85]] 错误:无法从 SQL 命令的参数中检索目标列描述。
当我在图像中执行 SSIS 任务时。它在左下角“将更新的记录加载到 Table_vwAs..” oleDb 更新任务中失败。它具有以下 sql 语句,并且还具有如下所示的触发器。到目前为止,我还无法确定此问题的原因。 当我禁用触发器时,任务运行成功。任何帮助都会让人大开眼界。
UPDATE
[dbo].[Sec]
SET
[SecID]=?
,[SECURITY_NAME]=?
,[SECURITY_SECTYPE_ID]=?
,[SECURITY_EXCHANGE_ID]=?
WHERE
[MasterID]=?
触发代码如下:
alter trigger [dbo].[TrTable_Fixed_AFTERUPDATE] on [dbo].[Sec]
after insert ,update
as
set NOCOUNT on
declare @DBMailDistributionListId varchar(50)
declare @ProfileName varchar(max)
declare @Recipients varchar(max)
declare @CopyRecipients varchar(max)
declare @BlindCopyRecipients varchar(max)
set @DBMailDistributionListId = 'Crossadyne1'
set @ProfileName = SharedCode.dbo.FnGetDBMailDistributionListProfileName(@DBMailDistributionListId)
set @Recipients = SharedCode.dbo.FnGetDBMailDistributionListRecipients(@DBMailDistributionListId)
set @CopyRecipients = SharedCode.dbo.FnGetDBMailDistributionListCopyRecipients(@DBMailDistributionListId)
set @BlindCopyRecipients = SharedCode.dbo.FnGetDBMailDistributionListBlindCopyRecipients(@DBMailDistributionListId)
declare @Subject varchar(max)
declare @Body varchar(max)
set @Body = ''
select distinct @Body = @Body + 'Master Sec ID: ' + convert(nvarchar(50) ,i.MasterId) + char(13) + char(10)
+ 'New Legal Entity ID: ' + convert(nvarchar(50) ,i.[INTERNAL_SECURITY_LEGALENTITY_ID])
from INSERTED i
inner join DELETED d
on i.MasterId = d.MasterId
where i.[INTERNAL_SECURITY_LEGALENTITY_ID] <> d.[INTERNAL_SECURITY_LEGALENTITY_ID]
and i.Security_Change_Date = i.LegalEntityChangeDate
and i.LegalEntityChangedBy not in (2 ,5)
if (@Body <> '')
begin
set @Subject = 'WARNING: Crossadyne Security Legal Entity changed'
exec msdb.dbo.sp_send_dbmail
@profile_name = @ProfileName
, @recipients = @Recipients
, @copy_recipients = @CopyRecipients
, @blind_copy_recipients = @BlindCopyRecipients
, @subject = @Subject
, @body = @Body
end
set @DBMailDistributionListId = 'test'
set @ProfileName = SharedCode.dbo.FnGetDBMailDistributionListProfileName(@DBMailDistributionListId)
set @Recipients = SharedCode.dbo.FnGetDBMailDistributionListRecipients(@DBMailDistributionListId)
set @CopyRecipients = SharedCode.dbo.FnGetDBMailDistributionListCopyRecipients(@DBMailDistributionListId)
set @BlindCopyRecipients = SharedCode.dbo.FnGetDBMailDistributionListBlindCopyRecipients(@DBMailDistributionListId)
set @Body = ''
select distinct @Body = @Body + 'Master ID: ' + convert(nvarchar(50) ,i.MasterId) + char(13) + char(10)
+ 'Previous Legal Entity ID: ' + convert(nvarchar(50) ,d.[INTERNAL_SECURITY_LEGALENTITY_ID])
from INSERTED i
inner join DELETED d
on i.MasterId = d.MasterId
where i.[INTERNAL_SECURITY_ID] <> d.[INTERNAL_SECURITY_LEGALENTITY_ID]
if (@Body <> '')
begin
set @Subject = 'WARNING: Crossadyne Security Legal Entity changed'
exec msdb.dbo.sp_send_dbmail
@profile_name = @ProfileName
, @recipients = @Recipients
, @copy_recipients = @CopyRecipients
, @blind_copy_recipients = @BlindCopyRecipients
, @subject = @Subject
, @body = @Body
end
set NOCOUNT off
【问题讨论】:
我认为您提到的错误上方有错误发布 如果你的 UPDATE 是在Sec
上,你为什么要在 Table_Fixed
上向我们展示一个触发器?
感谢选项卡。在发布到公共论坛之前,我在重命名某些实体时犯了一个错误。我的不好,它已得到纠正。
【参考方案1】:
这个问题是由于exec msdb.dbo.sp_send_dbmail
在触发代码中,因为它没有在 QA 服务器上配置。在我评论这些行后解决。
【讨论】:
以上是关于SSIS 错误:无法从 SQL 命令的参数中检索目标列描述的主要内容,如果未能解决你的问题,请参考以下文章
如何从数据库中检索 bigint 并将其放入 SSIS 中的 Int64
SQL server 2008中使用SSIS从一个数据库导入数据到另一个数据库,[SQL Server 目标 [22]] 错误: 无法准备 S