O'Reilly logo

Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started by Charlie Arehart, Raymond Camden, Ben Forta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

<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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required