Here's an example. The NOCOUNT is inportant in SQL Server, I'm not sure in
other DBMS's:
<cfquery name="insertEmail" DATASOURCE=#request.server.myDSN#>
SET NOCOUNT ON
insert into emailContent
(emailName,subjectLine,cashierP,courseTypeID,genericContent,corpContent,dist
Content,courseIDreqP,keyword)
Values
('#form.emailName#',
'#form.subjectLine#',
#form.cashierP#,
#form.courseTypeID#,
'#form.genericContent#',
'#form.corpContent#',
'#form.distContent#',
#form.courseIDreqP#,
'#form.keyword#')
SELECT newID = @@IDENTITY
SET NOCOUNT OFF
</cfquery>
-----Original Message-----
From: Jones, Becky [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 05, 2001 9:02 AM
To: CF-Talk
Subject: update
is there anyway to output the last primary key number in a table after an
insert statement?
i need to capture that number on the same action page so i can pass it to
another table.
in other words, on my insertApp.cfm i have the query to update my apps
table.
but on this same page at the bottom, i have another form...a form to update
the licensing. when i submit this form, i need that primary key from my
apps table to pass thru to my licensing table.
so i need a way to capture that value.
any ideas?
*************************************************
This e-mail, including any attachments, is intended for the
receipt and use by the intended addressee(s), and may contain
confidential and privileged information. If you are not an intended
recipient of this e-mail, you are hereby notified that any unauthorized
use or distribution of this e-mail is strictly prohibited.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists