<cftransaction> <cfquery name="test" datasource="test"> INSERT INTO test (id,name) VALUES (1,"santy"),(2,"raj"),(3,"nil") </cfquery> <cfquery name="test1" datasource="test"> SELECT ROW_COUNT() AS numberOfRowsAffected </cfquery> </cftransaction> <cfdump var="#test1.numberOfRowsAffected#">
Or
You can make changes to the settings to allow multiple sql statements with one cfquery. To make this happen, make changes as follows:
In ColdFusion Admin, go to the data source definition form and add allowMultiQueries = true in the "Connection string" field. Once you do this, you can pass multiple semicolon-delimited queries in a single CFQUERY tag. Just make sure you use CFQUERYPARAM for escaping for SQL Injection Attacks.
source share