SSIS错误:无法从SQL命令的参数中检索目标列描述

时间 2019-02-22
阅读 71
点赞 0
收藏 0
连接shiv-sidhu

SSIS task

我得到一个错误:

[将更新的记录加载到表vwas FixedIdentifier[85]]错误:无法从SQL命令的参数中检索目标列描述。

当我执行映像中的SSIS任务时。它在左下角的“将更新的记录加载到表_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
建议答案

问题的原因是
exec msdb.dbo.sp_send_dbmail
在触发代码中,因为它没有在QA服务器上配置。在我评论了那些行之后解决了。

👍 0