SQL Server TRY_CONVERT未按预期工作

时间:2016-01-28 21:33:51

标签: sql-server

参见附图 - 我无法弄清楚TRY_CONVERT返回null的原因。我也在这里发布了代码,但它只是显示原始字段,字段转换为datetime,然后是一个字符串(等于字段 - 正如我在我的case语句中所示)被转换为a约会时间。是什么赋予了?

select b.[Sent to Simon Mgmt for Signature], 
TRY_CONVERT(datetime, b.[Sent to simon mgmt for signature]) as CONVERTED_FIELD, 
TRY_CONVERT(datetime, '05/27/2015') as CONVERTED_STR,
case when '05/27/2015' = b.[Sent to simon mgmt for signature] then 'EQUAL' else 'FALSE' end as ARE_VALUES_EQUAL from Opportunity a
left join ssle.dbo.LRA_Status b on Opportunity_Id__c = b.DealId
where Opportunity_Id__c = '20150424163443BAUN-9VVS5Q'

SQL输出

05/27/2015 | NULL | 2015-05-27 00:00:00.000 | EQUAL

sql output

0 个答案:

没有答案