• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Excel and columnnames

New Here ,
Sep 14, 2006 Sep 14, 2006

Copy link to clipboard

Copied

Hello,

I've been trying to set vars from the result list of an excelsheet.
After making an ODBC connection for the excelsheet and querying the sheet, everything seems fine.
The problem is that some columnnames have dots (.) in it, which CF changes it to number signs (#)
My code is trying to set the result in a struct, but I cannot escape the number signs.

Example: <cfset somevar = somecolumnnamewith## />

I've used double number signs and all kinds of escaping techniques, but all in vain.
Does anyone know what the problem is and have a solution for it?
TOPICS
Advanced techniques

Views

235

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Sep 14, 2006 Sep 14, 2006

Copy link to clipboard

Copied

Since you are doing a query on your spreadsheet, have you tried to alias the column name within the query, then using the alias in CF?

SELECT somecolumnnamewith# AS new_somecolumnname
FROM.......

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 14, 2006 Sep 14, 2006

Copy link to clipboard

Copied

LATEST
Thanks for giving me the tip, paross.
I totally forgot about aliasing =)
Altho the correct way was:

SELECT [somecolumnnamewith##] AS new_somecolumnname
FROM .....

For anyone reading this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation