SELECT CASE WHEN ISNULL(STAFFING_PRIORITY_CODE,'') = 'Billable' AND
RESOURCE_TYPE in ('confirmed','provisional')AND PROJECTTYPE IN (select
ProjectType from OracleProjectTypeClass WHERE ShortName IN ('FB','TM'))
THEN CAST(ISNULL([%_WORK_ALLOCATION],0) AS decimal(18,2))
ELSE 0 END as [Billable]From [DBO].BenchDashboard where EMPLOYEE_ID=107500
此查询结果为: -
计费
100.00
我们在select语句中再添加一列: -
SELECT CASE WHEN ISNULL(STAFFING_PRIORITY_CODE,'')='Billable'ANDRESOURCE_TYPE in('confirmed','provisional')
AND PROJECTTYPE IN (select ProjectType from OracleProjectTypeClass WHERE ShortName IN ('FB','TM'))
THEN CAST(ISNULL([%_WORK_ALLOCATION],0) AS decimal(18,2)) ELSE 0 END as [Billable]
--added column
,CASE WHEN ISNULL(STAFFING_PRIORITY_CODE,'') = 'Buffer' AND RESOURCE_TYPE in ('confirmed','provisional')
AND PROJECTTYPE IN (select ProjectType from OracleProjectTypeClass WHERE ShortName IN ('FB','TM'))
THEN CAST(ISNULL([%_WORK_ALLOCATION],0) AS decimal(18,2)) ELSE 0 END as [Buffer]From [DBO].BenchDashboard where EMPLOYEE_ID=107500
给出结果
计费|缓冲器
0.0 | 0.00
第一列(Billable)的数据从100变为0为什么? 1)此Sql代码在sql server 2008r2或兼容级别100中正常工作 但是在兼容级别140或sql server 2017中出现了问题
结果应该是: -
计费|缓冲器
100.00 | 0.00
提前致谢
请找到