Skip to main content
Ben Nadel at cf.Objective() 2010 (Minneapolis, MN) with: Doug Hughes and Ezra Parker and Dan Wilson and John Mason and Jason Dean and Luis Majano and Mark Mandel and Brian Kotek and Wil Genovese and Rob Brooks-Bilson and Andy Matthews and Simeon Bateman and Ray Camden and Chris Rockett and Joe Bernard and Dan Skaggs and Byron Raines and Barney Boisvert and Simon Free and Steve 'Cutter' Blades and Seth Bienek and Katie Bienek and Jeff Coughlin
Ben Nadel at cf.Objective() 2010 (Minneapolis, MN) with: Doug Hughes Ezra Parker Dan Wilson John Mason Jason Dean Luis Majano Mark Mandel Brian Kotek Wil Genovese Rob Brooks-Bilson Andy Matthews Simeon Bateman Ray Camden Chris Rockett Joe Bernard Dan Skaggs Byron Raines Barney Boisvert Simon Free Steve 'Cutter' Blades Seth Bienek Katie Bienek Jeff Coughlin

ColdFusion Error: The Column Name "3a" Is Invalid

By
Published in

I was writing some test code for a query I am working with and I got the error: The column name "3a" is invalid. I was trying to run this line of code:

qTest = QueryNew( "id, name, 3a" );

While "3a" might seem like a strange column name, that is indeed the name of a column (along with MANY others that start with a number) in an actual client database. It works fine when writing SQL statements:

SELECT
	id,
	name,
	[3a]
FROM
	test

... because I can use the [ ] notation: [3a]. I tried to use the similar notation in the QueryNew() method, but to no avail:

qTest = QueryNew( "id, name, [3a]" );

This gives me the same error. I guess you can't simulate poorly named columns in QueryNew(). I would say that's a bug, but is it? If anything it's a flag that says "Don't name your columns with numbers."

Want to use code from this post? Check out the license.

Reader Comments

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel
Managed hosting services provided by:
xByte Cloud Logo