ColdFusion: cfquery and the SQL insert statements

Written on 12 March 2011, 01:09pm

Tagged with: , ,

Say you have a cfquery statement which does a simple insert in a table in your database:

<cfquery name="query_name" result="result_name">
INSERT INTO mytable(id,name) VALUES(1,'foo')
</cfquery>

This post presents two very useful and least documented features of the cfquery tag.

1. How to get the newly inserted ID

The ColdFusion 9 documentation offers several solutions depending on your database:
(more…)