我正在尝试在ALM(过去已经成功运行)中运行SQL查询,并且收到以下错误:
[Mercury] [SQLServer JDBC驱动程序] [SQLServer]
将varchar值'e2695'转换为数据类型int时,转换失败。
奇怪的是,仅当我将行and cast(au_time as date) <= cast('2019/06/19' as date)
更改为大于'2019/06/16'的日期时,才会出现此错误
Select *
From
(Select bg_bug_id Task_ID,
bg_summary Task_Summary,
bg_user_02 Task_Type,
bg_user_20 Task_Status,
bg_user_14 Task_Application,
bg_user_09 Task_Functional_Tower,
bg_user_24 Task_Assigned_Team,
bg_user_27 Task_Assigned_To_Name,
bg_user_12 Estimated_Fix_date,
AU_ACTION_ID,
AU_USER,
AU_TIME,
getdate() CurrentDate,
AP_PROPERTY_ID,
AP_OLD_VALUE,
AP_NEW_VALUE
From
ecs_data_conversion_db.td.bug
Left Join
ecs_data_conversion_db.td.audit_log On (bg_bug_id = AU_ENTITY_ID)
Left Join
ecs_data_conversion_db.td.audit_properties On (audit_log.AU_ACTION_ID = audit_properties.AP_ACTION_ID and AP_FIELD_Name = 'bg_user_20')
Where
cast(au_time As Date) >= cast('2019/01/01' As Date)
and cast(au_time as date) <= cast('2019/06/19' as date)
and cast(bg_user_20 as varchar) = cast('53 User Acceptance Testing' as varchar)
) d_table
Where
AP_PROPERTY_ID is not null
Order by
task_id, au_time
知道e2695是员工ID码可能会有所帮助。也许不太重要,该用户只是被提供了对我要查询的工具的访问权限。