This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01BFA09D.4F0AFC20
Content-Type: text/plain;
        charset="iso-8859-1"

In referring to this article: 
http://www.defusion.com/articles/index.cfm?ArticleID=72 

The method below of inserting a record is not a 
reliable way to get the corresponding record id 
in Cold Fusion:

Is this article correct in stating this method does 
not work, even if the code is wrapped in a 
CFTRANSACTION?? 

What is the best, scalable method for retrieving 
the identity field from the database, in the 
anticipation of heavy traffic? 

Thanks, Heres the code:
--------------------------------
<cftransaction>

<cfquery name="my_insert" datasource="whatever">
    INSERT INTO myTable
       ...
</cfquery>

<cfquery name="get_id" datasource="whatever">
    SELECT MAX(myTable.ID) as new_id
   FROM myTable
</cfquery>

</cftransaction>

Scott Becker
Web Developer : ConnectWise, Inc.
www.ConnectWise.com


------_=_NextPart_001_01BFA09D.4F0AFC20
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12">
<TITLE>HELP Getting Identity Field Accurately</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2 FACE=3D"Arial">In referring to this article: </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"><A =
HREF=3D"http://www.defusion.com/articles/index.cfm?ArticleID=3D72" =
TARGET=3D"_blank">http://www.defusion.com/articles/index.cfm?ArticleID=3D=
72</A> </FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">The method below of inserting a record =
is not a </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">reliable way to get the corresponding =
record id </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">in Cold Fusion:</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Is this article correct in stating =
this method does </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">not work, even if the code is wrapped =
in a </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">CFTRANSACTION?? </FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">What is the best, scalable method for =
retrieving </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">the identity field from the database, =
in the </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">anticipation of heavy traffic? =
</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Thanks, Heres the code:</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">--------------------------------</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&lt;cftransaction&gt;</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">&lt;cfquery =
name=3D&quot;my_insert&quot; =
datasource=3D&quot;whatever&quot;&gt;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp; INSERT INTO =
myTable</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
...</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&lt;/cfquery&gt;</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">&lt;cfquery name=3D&quot;get_id&quot; =
datasource=3D&quot;whatever&quot;&gt;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp; SELECT =
MAX(myTable.ID) as new_id</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp; FROM myTable</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&lt;/cfquery&gt;</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">&lt;/cftransaction&gt;</FONT>
</P>

<P><B><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Verdana">Scott =
Becker</FONT></B>
<BR><FONT COLOR=3D"#000000" SIZE=3D1 FACE=3D"Verdana">Web Developer : =
ConnectWise, Inc.</FONT>
<BR><I><FONT COLOR=3D"#000000" SIZE=3D1 =
FACE=3D"Verdana">www.ConnectWise.com</FONT></I>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01BFA09D.4F0AFC20--
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to