可变值:-89
错误消息
包验证错误
其他信息:
DFT_SSISDB_To_DWH错误[OLEDB_SRC_executions& event_messages [58]]:SSIS错误代码DTS_E_OLEDBERROR。发生OLE DB错误。错误代码:0x80040E14。 OLE DB记录可用。来源:“Microsoft SQL Server Native Client 11.0”Hresult:0x80040E14描述:“语句无法准备。”。 OLE DB记录可用。来源:“Microsoft SQL Server Native Client 11.0”Hresult:0x80040E14描述:“必须声明标量变量”@“。”。
DFT_SSISDB_To_DWH [SSIS.Pipeline]出错:“OLEDB_SRC_executions& event_messages”验证失败,返回验证状态“VS_ISBROKEN”。
DFT_SSISDB_To_DWH [SSIS.Pipeline]出错:一个或多个组件验证失败。
DFT_SSISDB_To_DWH出错:任务验证期间出现错误。
(Microsoft.DataTransformationServices.VsIntegration)
VARIABLE QUERY
"SELECT Distinct
em.event_message_id
--,em.operation_id
,ex.execution_id
,em.package_name
,CASE
WHEN em.message_source_type = 10 THEN '10 - Entry APIs, such as T-SQL and CLR Stored procedures'
WHEN em.message_source_type = 20 THEN '20 - External process used to run package (ISServerExec.exe)'
WHEN em.message_source_type = 30 THEN '30 - Package-level objects'
WHEN em.message_source_type = 40 THEN '40 - Control Flow tasks'
WHEN em.message_source_type = 50 THEN '50 - Control Flow containers'
WHEN em.message_source_type = 60 THEN '60 - Data Flow task'
END as message_source_type_description
,em.message
--,em.subcomponent_name
--,em.package_path
,em.message_time
,ex.created_time
,ex.server_name
FROM [catalog].[event_messages] em WITH (NOLOCK)
INNER JOIN [catalog].[executions] ex WITH (NOLOCK) ON ex.execution_id = em.operation_id
WHERE em.message_type = 120 --Selects Errors Only. Add 110 for Warnings
AND ex.created_time >= DATEADD(SECOND,-1,CONVERT(datetime, CONVERT(date, DATEADD(DAY, **@[User::LastDayTime]**, GETDATE()))))
--AND ex.execution_id = 628"
答案 0 :(得分:2)
替换此 @ [User :: LastDayTime]
与
"+ @[User::LastDayTime] + "
它会以这种方式使用你的变量。
将您的评论合并到我的答案中:
设置变量@sql =
"SELECT Distinct
em.event_message_id
--,em.operation_id
,ex.execution_id
,em.package_name
,CASE
WHEN em.message_source_type = 10 THEN '10 - Entry APIs, such as T-SQL and CLR Stored procedures'
WHEN em.message_source_type = 20 THEN '20 - External process used to run package (ISServerExec.exe)'
WHEN em.message_source_type = 30 THEN '30 - Package-level objects'
WHEN em.message_source_type = 40 THEN '40 - Control Flow tasks'
WHEN em.message_source_type = 50 THEN '50 - Control Flow containers'
WHEN em.message_source_type = 60 THEN '60 - Data Flow task'
END as message_source_type_description
,em.message
--,em.subcomponent_name
--,em.package_path
,em.message_time
,ex.created_time
,ex.server_name
FROM [catalog].[event_messages] em WITH (NOLOCK)
INNER JOIN [catalog].[executions] ex WITH (NOLOCK) ON ex.execution_id = em.operation_id
WHERE em.message_type = 120 --Selects Errors Only. Add 110 for Warnings
AND ex.created_time >= DATEADD(SECOND,-1,CONVERT(datetime, CONVERT(date, DATEADD(DAY, " + @[User::LastDayTime] + ", GETDATE()))))
--AND ex.execution_id = 628"
在执行sql任务中执行变量@sql
同样的事情:
@sql =
"DELETE [etl].[ErrorMessage] where created_time <= ( DATEADD(SECOND,-1,
CONVERT(datetime, CONVERT(date, DATEADD(DAY, "+ @variable +", GETDATE())))))"
现在执行@sql