How to read columns with spaces from coldfusion queries?

荒凉一梦 提交于 2019-12-02 06:18:53

I did crazy stuff like googling to see what people had done in other situations, and tried various SQL approaches to escaping non-standard column names (back ticks, square barackets, double quotes, combos thereof) , and drew a blank. So I agree with @da_didi that QoQ/IMQ does not cater for this. You should raise a ticket in the Adobe bug tracker.

You could do SELECT *, which removes the need to reference the column name. Or you could serialize the query, use a string replace to rename the column, deserialise it again then QoQ on the revised name. I'd only do this with a small amount of data though.

Or you could push back on the owbner of the XLS file and say "no can do unless you revise your column names".

You could also perhaps suppress the column names as they stand from the XLS file using excludeHeaderRow,and then specify your own columns names. How did I find out one could do that? By RTFMing the <cfspreadsheet> docs.

You cannot. Best practices: I always replace all spaces with an underline.

Simple. Just alias the select. Select [FIRST NAME] as FIRSTNAME from qryObj

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!