I've used a table.  Here's one approach for SQL7:

<cfquery name="AddRow" datasource="#DSN#" password="#pass#" username="#user#">
BEGIN TRANSACTION
UPDATE MAX_ID_orgs SET MAX_ID_org = MAX_ID_org + 1
DECLARE @MAX INT
SELECT @MAX = MAX_ID_org FROM MAX_ID_orgs
INSERT INTO Orgs
(ID, Class, Contact, org_name, org_add, City, State, Zip, Telephone, Credit)
VALUES
(@MAX, #Session.ClassNumber#, '#Form.Contact#', '#Form.org_name#', 
'#Form.org_add#', '#Form.City#', '#Form.State#', '#Form.Zip#', 
'#Form.Telephone#', '#Session.Credit#')
COMMIT TRANSACTION
</cfquery>

best,  paul


At 03:21 PM 8/3/00 -0400, you wrote:
>Although the below method is a very widely used one, it is not always going
>to work. Especially if you have a very high traffic site. I read, just a few
>days ago, the various problems encountered with the method below. They
>suggested creating a table with ID's and when you need one, just grab it.
>There are issues with that method as well, but it is an option. To read more
>about it, go here: http://www.defusion.com/articles/index.cfm?ArticleID=72
>
>~Mark
>
>-----Original Message-----
>From: Jim Mixon [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, August 03, 2000 10:32 AM
>To: [EMAIL PROTECTED]
>Subject: Re: Access AutoiNumber Fields
>
>
>
><CFTRANSACTION>
><CFINSERT table="name" DATASOURCE="name">
><CFQUERY NAME="name" DATASOURCE="name">
>     select Max(id) as NewID
>     from TABLENAME
></CFQUERY>
></CFTRANSACTION>
>
>New Record ID = name.NewID
>
>
>
> >How do you get the value used by Access in an AutoNumber field.  For
> >example, you insert a record into one table and then, within the same
> >template, need to use the ID assigned to that record.
> >
> >
> >
> >***************************************
> >Jonathan R. Karlen
> >Karlen Internet Solutions
> >Web Site and Application Development
> >[EMAIL PROTECTED]
> >http://www.karlen.com
> >
> >
> >------=_NextPart_000_0004_01BFFD33.9974EEC0
> >Content-Type: text/html;
> >         charset="iso-8859-1"
> >Content-Transfer-Encoding: quoted-printable
> >
> >xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
> >xmlns=3D"http://www.w3.org/TR/REC-html40">
> >
> >How do you get the value used by Access in an AutoNumber field.
> >
> >
> >
> >
> >
> >
> >
> >***************************************<= /p>
> >
> >Jonathan R. Karlen<= /p>
> >
> >Karlen Internet Solutions<= /p>
> >
> >Web Site and Application = Development<= /p>
> >
> >[EMAIL PROTECTED]<= /p>
> >
> >http://www.karlen.com<= /p>
> >
> >  <= /p>
> >
> >------=_NextPart_000_0004_01BFFD33.9974EEC0--
> >
> >---------------------------------------------------------------------------
>---
> >Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> >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.
>
>Jim Mixon - CEO
>APT POINT NET, Inc. "A Premiere InterNET Gateway" . . .
>[EMAIL PROTECTED]   http://www.apt.net/
>8405 NW 53 St.  Miami, FL 33166  305-418-4111
>FAX (305) 418-4111 press 7 and SEND!
>powered by Cold Fusion 4.01 . . . . feel the force!
>CF Hosting Now Available . . . . !
>----------------------------------------------------------------------------
>--
>Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
>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.
>------------------------------------------------------------------------------
>Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
>To Unsubscribe visit 
>http://www.houseoffusion.com/index.cfm?sidebarsts&bodysts/cf_talk or send 
>a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
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