Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started
by Ben Forta, Raymond Camden, Charlie Arehart
<cfinsert> vs. SQL INSERT
Adding data to tables using the ColdFusion <cfinsert> tag is simpler and helps prevent the creation of multiple similar templates.
So why would you ever not use <cfinsert>? Is there ever a reason to use SQL INSERT instead of <cfinsert>?
The truth is that both are needed. <cfinsert> can be used only for simple data insertion to a single table. If you want to insert the results of a SELECT statement, you can’t use <cfinsert>. And you can’t use <cfinsert> if you want to insert values other than FORM fields—variables or URL parameters, for example.
These guidelines will help you decide when to use which method:
For simple operations (single table and no complex processing), use <cfinsert> to add data.
If you find that you ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access