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

Multiple statements in one cfquery

Contributor ,
May 23, 2008 May 23, 2008
Providing there is only one or no SELECT statement, can I issue multiple statements to a database inside a single cfquery?

For example will this work correctly:

<cfquery datasource="myDB" username="myUserName" password="myPassword">
CREATE TABLE dbo.table1 ( ... );
CREATE INDEX Ix1 ON dbo.table1 (col1);
CREATE TABLE dbo.table2 ( ... );
etc...
</cfquery>

or must I SET NOCOUNT ON and put GO between each statement? (I am working with SQL Server 2005.)

Doug
TOPICS
Database access
620
Translate
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

correct answers 1 Correct answer

LEGEND , May 24, 2008 May 24, 2008
doug777 wrote:
> or must I SET NOCOUNT ON and put GO between each statement? (I am working with
> SQL Server 2005.)

no, just wrap the mess of sql in a NOCOUNT ON/OFF block.
Translate
LEGEND ,
May 24, 2008 May 24, 2008
doug777 wrote:
> or must I SET NOCOUNT ON and put GO between each statement? (I am working with
> SQL Server 2005.)

no, just wrap the mess of sql in a NOCOUNT ON/OFF block.
Translate
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
Contributor ,
May 24, 2008 May 24, 2008
LATEST
Thanks very much. That makes the whole thing very straightforward.

Doug
Translate
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