Cfloop inside of cfquery

So… Does anyone know of an issue specific to Lucee that prevents
this… I have tried the following and the first example works, but the
second example (the more efficient one) doesn’t.

<cfloop from="1" to="3" index="i">
<cfquery>
ALTER TABLE Ranks ADD COLUMN #Callsign#RankName#i# VARCHAR(100);
</cfquery>
</cfloop>

<cfquery>
<cfloop from="1" to="3" index="i">
ALTER TABLE Ranks ADD COLUMN #Callsign#RankName#i# VARCHAR(100);
</cfloop>
</cfquery>

Any thoughts as to why or if this a known issue?

What error message do you get? Maybe an issue with multiple queries per
call?

facepalm There is. Thank you. :slight_smile:

On Wed, Jan 18, 2017 at 10:02 AM, Mark Drew <@Mark_Drew> wrote:

I am pretty sure there is a setting in the data source screen about running
multiple statements?

Mark Drew

On 18 Jan 2017, at 17:47, Joseph Gooch <@Joseph_Gooch> wrote:

My guess is either MySQL closes the batch after a DDL statement, or the JDBC
semantics are different from the client. (For all we know, ; starts a new
batch in the manager)

You can probably deal with the syntax differently:
https://stackoverflow.com/questions/17541312/alter-table-add-multiple-columns-after-column1

-G

On Wed, Jan 18, 2017 at 12:42 PM, Phillip Vector <@Phillip_Vector> wrote:

MySQL

Well, when I try it on a query panel on my manager, it works fine. So
I presume it’s Lucee giving the error.

What SQL Server?

Is it Lucee or the SQL Server that’s sending the error?

-G