Multiple SQL Statements

by Kyle Hayes on July 10th, 2006

If you are interested in executing multiple SQL statements inside a single cfquery block and posting them to a SQL Server database, then you are in luck. While attempting to create an install file for an application I am working on for work, I went into Sql Server Enterprise Manager to have it create the SQL for creating the various tables that my application needs. After copying the code directly from the file that Enterprise Manager created and copying it into my cfquery block, the page failed to execute.

Much searching produced no results on why this was happening. What I finally figured out by process of elimination is that you cannot use the GO keyword that SQL Server uses in its SQL statements to combine multiple statements, instead, simply replace all GO keywords with a semi-colon at the end of each of your statements and you will be good to go.

Popular Posts

From Uncategorized

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS