Coldfusion query of queries with a reserved word in SQL

My client has a stored procedure that was returning a column named "level". While trying to execute a query of queries on the resultset, I ran into some issues because "Level" is a reserved word in T-SQL. The stored proc simply returns a column aliased as "level". Its not actually that in the table, so this problem wasn't an issue previously.

I was going to change the stored procedure itself, but other applications rely on the naming structure already in place. Any change would be a pain.

I was able to work with the query of queries by putting brackets around my reserved word column. Now ColdFusion and Sql are quite happy!

<cfquery dbtype="query" name="shortenedQuery">
   SELECT categoryName, [level], name
   FROM queryResults
</cfquery>

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.