在SELECT查询中的OLEDB案例 [英] OLEDB CASE WHEN in SELECT Query
问题描述
如何将case when
语句与oledb一起用于excel文件?
就像select prodid, case prodid when 1 then 'fine' when 2 then 'good' end
How can use case when
statement with oledb to excel file ?
Like select prodid, case prodid when 1 then 'fine' when 2 then 'good' end
推荐答案
OLEDB只是一种中继",仅对基础源重复查询.
OLEDB is only a "relay" of sort and merely repeats the query to the underlying source.
我不认为Excel支持CASE WHEN构造,因此即使通过OLEDB也无法使用它.
I don't believe Excel supports the CASE WHEN construct, and thence you cannot use it, even through OLEDB.
You can instead use an Excel-specific idiom, the IIF() function, as described in CodeByMoonlight's answer. As noted the need to nest IIF() calls makes is a rather messy proposal for situations that require more than 3 or 4 cases.
这篇关于在SELECT查询中的OLEDB案例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!