Ошибка служб SSIS: невозможно получить описания столбцов назначения из параметров команды SQL - PullRequest
0 голосов
/ 22 февраля 2019

SSIS task

Я получаю сообщение об ошибке:

[Загрузить обновленные записи в 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

1 Ответ

0 голосов
/ 22 февраля 2019

Проблема была вызвана из-за
exec msdb.dbo.sp_send_dbmail
в коде триггера, поскольку он не настроен на сервере QA.Решено после того, как я прокомментировал эти строки.

...