View comments | RSS feed
Contents > Developing ColdFusion MX Applications > Introduction to Databases and SQL > Using SQL > Modifying a database Updating multiple tables PreviousNext

Updating multiple tables

The examples in this section all describe how to modify a single database table. However, you might have a database that uses multiple tables to represent information.

One way to update multiple tables is to use one INSERT statement per table and to wrap all INSERT statements within a database transaction. A transaction contains one or more SQL statements that can be rolled back or committed as a unit. If any single statement in the transaction fails, you can roll back the entire transaction, cancelling any previous writes that occurred within the transaction. You can use the same technique for updates and deletes.


Contents > Developing ColdFusion MX Applications > Introduction to Databases and SQL > Using SQL > Modifying a database Updating multiple tables PreviousNext

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


dorothee@tpg.com.au said on Jun 5, 2004 at 7:29 PM :
I would love to see an example!!!
jrunrandy said on Jun 7, 2004 at 6:57 AM :
Here is one example:
<cftransaction>

<cfquery name="qInsEmp" datasource="cfsnippets">
INSERT INTO Employees (FirstName,LastName,EMail,Phone,Department)
VALUES ('Simon', 'Horwith', 'SHORWITH','(202)-797-6570','Research and Development')
</cfquery>

<cfquery name="qGetID" datasource="cfsnippets">
SELECT MAX(Emp_ID) AS New_Employee
FROM Employees
</cfquery>

</cftransaction>

For more information, see the article at http://www.macromedia.com/devnet/mx/coldfusion/articles/cftransaction.html.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/sql26.htm